在烧瓶模板的子串

AFS*_*AFS 2 python flask

我有一个循环来显示烧瓶模板中的列表内容,但我不想显示元素的第一个字符,这样在python中工作但不在烧瓶中

{%for file in files%}
        {% f= file['path'] %}
        <p> {{ f[1:] }}</p>
{% endfor %}
Run Code Online (Sandbox Code Playgroud)

我收到这个错误

TemplateSyntaxError: Encountered unknown tag 'f'. Jinja was looking for the following tags: 'endfor' or 'else'. The innermost block that needs to be closed is 'for'.
Run Code Online (Sandbox Code Playgroud)

Doo*_*beh 5

set如果您希望以这种方式使用它们,则需要变量.(文件).

那就是说 - 你应该能够{{ file['path'][1:] }}for循环中做到.