Variable within filename in jinja2 [duplicate]
问题 This question already has an answer here : Reference template variable within Jinja expression (1 answer) Closed 3 years ago . 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