4m1nh4j1
4m1nh4j1

Reputation: 4356

The equivalent of this loop in Jinja

I would like to know how can I perform this loop in Jinja :

for r,s in (v,t):
    #Do something

When I try to write something similar in Jinja(Flask), I had an error :

ValueError: too many values to unpack

v and t are lists of dicts .

Upvotes: 1

Views: 570

Answers (1)

4m1nh4j1
4m1nh4j1

Reputation: 4356

Found : In jinja I should use zipped

{% for s, t in zipped %}
#do something
{% endfor %}

where zipped = zip (s,t)

Upvotes: 2

Related Questions