语法和python一样,可以使用items()、keys()、values()、iteritems()、iterkeys()、itervalues()

{% for k, v in user.items() %}
        <p>{{ k }}: {{ v }}</p>
    {% endfor %}

flask学习(十二):for循环遍历

flask学习(十二):for循环遍历

flask学习(十二):for循环遍历

 

二. 列表的遍历

语法和python一样

{% for website in websites %}
        <p>{{ website }}</p>
{% endfor %}

flask学习(十二):for循环遍历

flask学习(十二):for循环遍历

flask学习(十二):for循环遍历 

三. 实例

flask学习(十二):for循环遍历

flask学习(十二):for循环遍历

flask学习(十二):for循环遍历

 

相关文章:

  • 2021-11-10
  • 2021-08-06
  • 2021-12-18
  • 2021-12-18
  • 2021-07-21
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-12-18
  • 2021-12-18
  • 2021-11-30
  • 2021-12-18
  • 2021-12-18
相关资源
相似解决方案