<!DOCTYPEhtml><htmllang="en"><head><metacharset="UTF-8"><metahttp-equiv="X-UA-Compatible"content="IE=edge"><metaname="viewport"content="width=device-width, initial-scale=1.0"><title>循环结构</title></head><body><h2>正向遍历列表</h2>
{% for it in items %}
<span>{{ it }}</span>
{% endfor %}
<br><h2>反向遍历列表</h2>
{% for it in items | reverse %}
<span>{{ it }}</span>
{% endfor %}
<br><h2>遍历字典</h2>
{% for x in udict.keys() %}
<span>{{ x }}</span>
{% endfor %}
<br>
{% for x in udict.values() %}
<span>{{ x }}</span>
{% endfor %}
<br>
{% for x in udict.items() %}
<h5>{{ x }} === {{ loop.index }} === {{ loop.index0 }} === {{ loop.first }} === {{ loop.last }} === {{ loop.lenght }}</h5>
{% endfor %}
<h2>实战:99乘法表</h2><divstyle="color: aqua;"><tableborder="1">
{% for i in range(1,10) %}
<tr>
{% for j in range(1, i+1) %}
<td>{{ i }} * {{ j }} = {{ i * j }}</td>
{% endfor %}
</tr>
{% endfor %}
</table></div></body></html>