Reputation: 11
How can i autoincrement a item of my list?
I have something like this:
data = {'port': [22,80,443], 'banner': ['OpenSSH','Apache2','Apache'], 'protocol': ['tcp','tcp','tcp'] }
{% for key, value in data.items %}
<tr>
<th class="white">{{key}}</th>
<th class="black">{{value.0}}</th>
</tr>
{% endfor %}
How can i autoincrement "value.0" to "value.1", "value.2" etc...
Maybe can i do it with forloop.counter0? But how?
thanks!
Upvotes: 1
Views: 58
Reputation: 78536
You can iterate over the values using another for
loop:
{% for key, value in ack.items %}
<tr>
<th class="white">{{key}}</th>
{% for v in value %}
<th class="black">{{v}}</th>
{% endfor %}
</tr>
{% endfor %}
Upvotes: 1