Jinja2迭代Python中的list列表和dict字典

简介: Jinja2迭代Python中的list列表和dict字典

经常使用flask的快速搭建效果,总是忘记,记录下

代码示例

# 迭代列表
{% for row in rows %}
  {{ row }}
{% endfor %}
# 迭代字典
{% for key, value in row.items() %}
  {{ key }}  {{ value }}      
{% endfor %}
相关文章
|
8天前
|
索引 Python
Python 列表、元素、字典
Python 列表、元素、字典
41 0
|
1月前
|
存储 安全 Java
Python教程第3章 | 集合(List列表、Tuple元组、Dict字典、Set)
Python 列表、无序列表、字典、元组增删改查基本用法和注意事项
51 1
|
1月前
|
Python
Python生成列表和字典
Python生成列表和字典
17 0
|
2月前
|
Python
Python列表推导式——List
Python列表推导式——List
29 0
|
9月前
|
索引 Python
Python中list和dict的详细用法
Python中list和dict的详细用法
96 0
|
9月前
|
Python 容器
python中dict的详细用法以及set集合使用
python中dict的详细用法以及set集合使用
142 0
|
10月前
|
存储 索引 Python
【Python】列表和字典
【Python】列表和字典
|
Python
Python 两个 List of Dict 去重
Python 两个 List of Dict 去重
122 0
Python 两个 List of Dict 去重
|
Python
Jinja2迭代Python中的list列表和dict字典
Jinja2迭代Python中的list列表和dict字典
303 0
|
Python
Python - dict 字典的多种遍历方式
Python - dict 字典的多种遍历方式
348 0