I want to do the below list iteration in django templates:
foo = ['foo', 'bar'];
moo = ['moo', 'loo'];
for (a, b) in zip(foo, moo):
print a, b
django code:
{%for a, b in zip(foo, moo)%}
{{a}}
{{b}}
{%endfor%}
I get the below error when I try this:
File "/base/python_lib/versions/third_party/django-0.96/django/template/defaulttags.py", line 538, in do_for
raise TemplateSyntaxError, "'for' statements should have either four or five words: %s" % token.contents
How do I accomplish this?
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…