html - 使用 Django 模板标签中的索引访问多个列表的值
问题描述
所以我有三个相同长度的列表a
,b
以及c
另一个d
只是从 0 到 的数字的列表len(a)
。我想在 html 表中显示前三个列表。所以我写道:
{% for i in d %}
<tr>
<td>{{a.i}}</td>
<td>{{b.i}}</td>
<td>{{c.i}}</td>
</tr>
{% endfor %}
出于某种原因,这不起作用,但如果更改i
为任何数字(如 0),它会正确显示每一行中每个列表的第一项。如何在模板标签中使用索引来显示我想要的内容?