我使用 jinja 2来输出 yaml 文件,但似乎无法去掉后面的换行符和 for 循环的结尾。下面的例子
- request:
path: {{ path }}
headers:
origin: 'somedomain.com'
user-agent: 'agent'
referer: 'some.domain.com'
authority: 'somedomain.com'
querystring:
{% for key, value in querystring.items() -%}
{{ key }}: '{{ value }}'
{% endfor %}
response:
content:
file: {{ content }}
给我输出:
- request:
path: /some/path
headers:
origin: 'somedomain.com'
user-agent: 'agent'
referer: 'somedomain.com'
authority: 'somedomain.com'
querystring:
postcode: 'xxxxxx'
houseNo: '55'
response:
content:
file: address.json
在房子后面多了一个不需要的空行。我怎么去掉这一行?