I'm trying to print a single blank line surrounding the results of a jinja2 for loop, but I just can't get it to work. Can someone tell me what I am doing wrong?
from jinja2 import Template, Environment
template = Template("""This is some text that should have a single blank line below it.
{% for i in range(10) -%}
line {{ i }}
{% endfor %}
This is some text that should have a single blank line above it.""")
template.environment = Environment(trim_blocks=True)
print(template.render())
This is the result I get:
This is some text that should have a single blank line below it.
line 0
line 1
line 2
line 3
line 4
line 5
line 6
line 7
line 8
line 9
This is some text that should have a single blank line above it.
However, I'm trying to configure it so that I don't get two blank lines above the final line, only one.