【发布时间】:2012-07-07 10:14:24
【问题描述】:
我在 python 中有一个list of dictionary,即
listofobs = [{'timestamp': datetime.datetime(2012, 7, 6, 12, 39, 52), 'ip': u'1.4.128.0', 'user': u'lovestone'}, {'timestamp': datetime.datetime(2012, 7, 6, 12, 40, 32), 'ip': u'192.168.21.45', 'user': u'b'}]
我想在 Django 模板中使用 listofobs 变量的所有键和值。例如:
第一次迭代:
timestamp = 7 july 2012, 12:39 Am
ip = 1.4.128.0
user = lovestone
第二次迭代:
timestamp = 7 july 2012, 12:40 Am
ip = 192.168.21.45
user = b
等等..
【问题讨论】:
标签: python django django-templates python-2.7