1 列表嵌套字典for循环
<table border="1"> <thead> <th >name</th> <th>age</th> <th>email</th> </thead> <tbody> {% for dict in user_list %} <tr> <td>{{ dict.name }}</td> <td>{{ dict.age }}</td> <td>{{ dict.email }}</td> </tr> {% endfor %} </tbody> </table>
2 字典嵌套字典for循环
<table border="1"> <thead> <th >name</th> <th>tally</th> </thead> <tbody> {% for name,tally in user_dict.items %} <tr> <td>{{ name }}</td> <td>{{ tally }}</td> </tr> {% endfor %} </tbody> </table>