djiango控制语句
作者:互联网
{# 从0开始的索引#} {% for foo in value %} <p>{{ forloop.counter0 }}: {{ foo }}</p> {% endfor %} {# 从1开始的索引#} {% for foo in value %} <p>{{ forloop.counter }}: {{ foo }}</p> {% endfor %} {# 索引倒叙#} {% for foo in value %} <p>{{ forloop.revcounter0 }}: {{ foo }}</p> {% endfor %}for循环
标签:语句,控制,counter,value,索引,endfor,forloop,foo,djiango 来源: https://www.cnblogs.com/jiefangzhe/p/10562875.html