jinja loop index
To use a loop index in Jinja, you can use the loop.index
variable. Here's an example:
{% for item in items %}
{{ loop.index }}: {{ item }}
{% endfor %}
In this example, items
is the list you want to iterate over. The loop.index
variable gives you the current index of the loop, starting from 1. You can use it to display the index alongside the item.
Let me know if you need further assistance!