我正在写一个模板jinja。在 html 文件中,我写道:
{% set tmpx, tmpy = 0 %}
{% for greeting in greetings %}
{% if greeting.author %}
{% tmpx = greeting.data_x %}
{% tmpy = greeting.data_y %}
{% endif %}
{% endfor %}
结果是程序找不到tmpx,tmpy。对如何使用全局集感到困惑。