How to iterate through a list of dictionaries in Jinja template?

后端 未结 5 1370
伪装坚强ぢ
伪装坚强ぢ 2020-12-07 20:00

I tried:

list1 = [{\"username\": \"abhi\", \"pass\": 2087}]
return render_template(\"file_output.html\", list1=list1)

In the template:

5条回答
  •  天涯浪人
    2020-12-07 20:23

    {% for i in yourlist %}
      {% for k,v in i.items() %}
        {# do what you want here #}
      {% endfor %}
    {% endfor %}
    

提交回复
热议问题