Reputation: 21
I have two variables, name = ["Fedora", "Ubuntu"]
and state = {"Fedora": "up", "Ubuntu": "down"}
.
How do I display this data in a loop?
{% for s in state %}
{% for n in state %}
{{ n }} {{ s }}
{% endfor %}
{% endfor %}
Variable "n" is displayed four times instead of two times.
Upvotes: 2
Views: 97
Reputation: 5198
Try this:
{% for n,s in state.items %}
{{ n }}: {{ s }}<br>
{% endfor %}
Upvotes: 4