0
我有一個列表的字典中它看起來像這樣:使用相同的密鑰和值到一個單一的詞典合併字典
{"items":[{"number":"98", "items": {"code": "X", "color": "Red"}},{"number":"98", "items": {"code": "Y", "color": "Blue"}},{"number":"62", "items": {"code": "B", "color": "Green"}}{"number":"62", "items": {"code": "A", "color": "Yellow"}}]}
有沒有一種方法,我可以合併的每個「數字」的項目這些值是否一致成爲一個像這樣的列表?
{"items":[{"number":"98","items":[{"code":"X","color":"Red"}, {"code": "Y","color":"Blue"}]}, {"number":"62", "items": [{"code": "B", "color": "Green"},{"code": "A", "color":"Yellow"}]}]}
哇,這正是我需要的太感謝你了!我一直在試圖找出最後一個小時。我想我應該多關注一下這個話題。 –