【发布时间】:2017-05-24 19:17:48
【问题描述】:
我在浏览器中有关注dictionary python 的输出数据
{'pid': 0, 'name': 'System Process'}
{'pid': 41, 'name': 'System123'}
{'pid': 110, 'name': 'svchost.exe'}
{'pid': 280, 'name': 'smss.exe'}
{'pid': 336, 'name': 'WSE.exe'}
{'pid': 424, 'name': 'csrss.exe'}
但想在我的template 中创建一个html / bootstrap table 以便输出table 看起来类似于:
PID NAME
0 System Idle Process
41 System123
110 svchost.exe
280 smss.exe
336 WSE.exe
.. ..
.. ...
一模一样Image
我的模板代码:
<body>
{% for obj in mydict_key %}
<table >
{{ obj }}
</table>
{% endfor %}
</body>
【问题讨论】:
-
{{ obj.pid }}时是否在浏览器中打印 PID? -
这是一个字典列表还是只有一些字典?
-
@RajaSimon nop 只是
pid的值 -
@doru 字典列表
标签: python html django twitter-bootstrap dictionary