Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个列表列表
list = [[1,2,3],[4,5,6],[7,8,9]]
如何显示模板中每个列表的第二个值:2、5、8?
<div> <ul class="list-group"> {% for item in list %} {{ item[1] }}, {% endfor %} </ul> </div>
您必须使用点符号来访问列表项:
<div> <ul class="list-group"> {% for item in list %} {{ item.1 }}, {% endfor %} </ul> </div>