【发布时间】:2015-09-16 11:24:12
【问题描述】:
我正在使用 Django 框架并尝试根据我在列表中的值构建一个表:
列表:[[1, 2, 3, 4], [5, 6, 7, 8], [9, 10, 11, 12], [3, 3, 3, 3]] 表
应该如下图:
我使用的代码是:
html = "<html><body><br>" \
"<table border=1 ><thead> <tr><th>result 1</th><th>result 2</th><th>result 3</th><th>result 4</th></tr><thead>{% for item in matrix %} {% for secitem in item %} <tr> <td> {{secitem[0]}} </td> <td> {{secitem[1]}} </td><td> {{secitem[2]}} </td><td> {{secitem[3]}} </td> </tr> {% endfor %}{% endfor %} " \
"</table></body></html>"
我无法获得包含所需行的确切表格。非常感谢任何帮助。![在此处输入图片描述][1]
【问题讨论】:
-
您的示例表不可见。
-
我无法上传图片。但是,它应该是一个包含列表值的 4X4 表。