I would like to do something like:
variable p is from test.py which is a list [\'a\',\'b\',\'c\',\'d\']
{% for i in p %} {{variable++}} {{variable}} >
You could use loop.index:
loop.index
{% for i in p %} {{ loop.index }} {% endfor %}
Check the template designer documentation.
In more recent versions, due to scoping rules, the following would not work:
{% set count = 1 %} {% for i in p %} {{ count }} {% set count = count + 1 %} {% endfor %}