Python 3.x 如何在django模板的for循环中传递2个参数

Python 3.x 如何在django模板的for循环中传递2个参数,python-3.x,django,django-views,django-templates,Python 3.x,Django,Django Views,Django Templates,我想在模板的for循环中传递2个参数 {% for x, y in text %} <p>{{ x }}</p><h1>{{ y }}</h1> {% endfor %} 这甚至不是循环,它完全不做任何事情 我需要在模板或“文本”中写些什么才能使此工作正常?{%for item in text%} {% for item in text %} <p>{{ item }}</p><h1>{{ ite

我想在模板的for循环中传递2个参数

{% for x, y in text %}

  <p>{{ x }}</p><h1>{{ y }}</h1>

{% endfor %}
这甚至不是循环,它完全不做任何事情

我需要在模板或“文本”中写些什么才能使此工作正常?

{%for item in text%}
{% for item in text %}

  <p>{{ item }}</p><h1>{{ item }}</h1>

{% endfor %}
{{item}}

{{item} {%endfor%}
对不起,我有
[(“e”、“w”、“q”),(“1”、“2”、“3”)]
这就是我犯的错误。
如何结束此问题?

这是您的整个模板?或者您使用了tempalte继承吗?不,它不是从Tamplate开始的两行,您确定模板的这一部分仍然呈现吗?由于模板继承/if条件等原因,并非所有部分都会呈现本身。抱歉,我不明白您能解释一下吗?在
for
循环之前添加调试行(例如
文本:{{Text}}}”
),以查看上下文变量是否有任何错误。
{% for item in text %}

  <p>{{ item }}</p><h1>{{ item }}</h1>

{% endfor %}