通過詞典列表我有Python字典看起來像這樣的列表:解析作爲POST參數
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'])
但我似乎不具有類型的字典列表時,我的數據到達我的客戶端應用程序。