我目前我的OrderedDict像下面。multiple OrderedDict to python的字典
d = [OrderedDict([('id', u'570c737e87f8dc15788790b7'), ('name', u'Murgh ')]), OrderedDict([('id', u'570c737e87f8dc15788790b6'), ('name', u'Mushroom')])]
但在這裏,我需要將其轉換爲正常的字典格式,如下所示。
{"id": "570c737e87f8dc15788790b7","name": "Murgh"
},
{
"id": "570c737e87f8dc15788790b6","name": "Mushroom"
}
如何從python中做到這一點。
這個問題似乎並不是http://stackoverflow.com/questions/20166749/how-to-convert-an-ordereddict-into-a-regular-dict-in-python3的重複,因爲問題中的數據結構不是OrderedDict,而是OrderedDicts的列表,所需的輸出也似乎是不同的ferent。 – fmarc