-
Description
Reproduction steps
Additional helpful information:
What did you expectI expect this to iterate over key-value pairs |
Beta Was this translation helpful? Give feedback.
Answered by
mitsuhiko
Mar 24, 2023
Replies: 1 comment
-
To iterate over key value pairs you need to use {% for key, value in my_dict|items %}
{{ key }}: {{ value }}
{% endfor %} Or alternatively {% for key in my_dict %}
{{ key }}: {{ my_dict[key] }}
{% endfor %} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
mitsuhiko
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To iterate over key value pairs you need to use
|items
or|dictsort
:Or alternatively