I have a dictionary like so: {'a': [Object, 0], 'b': [Object, 1] }
Where object is an actual object with multiple attributes. I'm trying to a check on each key to see if the second value in the array is a 0 or 1. If it is a 1, then I'll display "Hello" if it's a 0, I'll display "Goodbye" Here's what I have so far that doesn't seem to work:
{% for key in follower_list %}
{% if follower_list[key][1] == 0 %}
<p>Hello</p>
{% else %}
<p>Goodbye</p>
{% endif %}
Here, follower_list is the dictionary. I'm getting an error by my IDE saying operator expected where follower_list[key][1]
is there a way I can do this type of logic in Jinja?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…