【发布时间】:2011-03-04 16:01:41
【问题描述】:
我有一个 Python 字典列表,如下所示:
sandwiches = [
{'bread':'wheat', 'topping':'tomatoes', 'meat':'bacon'},
{'bread':'white', 'topping':'peanut butter', 'meat':'bacon'},
{'bread':'sourdough', 'topping':'cheese', 'meat':'bacon'}
]
我想将此作为 POST 参数传递给另一个 Django 应用程序。客户端应用需要做什么来遍历列表?
我想做这样的事情:
for sandwich in request.POST['sandwiches']:
print "%s on %s with %s is yummy!" % (sandwich['meat'], sandwich['bread'], sandwich['topping'])
但是当我的数据到达我的客户端应用程序时,我似乎没有字典列表。
【问题讨论】:
标签: python django post dictionary iteration