how to create counter loop in django template?

后端 未结 3 1684
無奈伤痛
無奈伤痛 2021-01-29 12:28

can any tell me how can I write below code of c in django

for(c=0; c<5; c++)
  //do something

i had tried below code but it gives me an erro

3条回答
  •  独厮守ぢ
    2021-01-29 12:55

    I was curious and found a way to do this. Disclaimer: I consider the following code to be WRONG:

    {% for i in "abcde" %} do something {% endfor %}
    

    Replace "abcde" with a string of the range you want.

提交回复
热议问题