问题
What is the right way to write something like this in jinja2 :
{% for items in zipped %}
<img src="{{ url_for('static', filename='img/{{items.logo}}') }}" />
Notice that items.logo
is within another variable .
回答1:
items.logo
is already a variable. Try:
{% for items in zipped %}
<img src="{{ url_for('static', filename='img/' + items.logo) }}" />
{% endfor %}
来源:https://stackoverflow.com/questions/20400320/variable-within-filename-in-jinja2