如何更新包含具有键/值对的字典的数组?

2024-10-02 00:34:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我正在迭代一个具有多个键/值对的对象,我希望每次迭代时都创建一个数组,同时更新找到键的特定值。我有寻找特定键的逻辑,但在如何获取字典数组方面我还是一片空白

data = [{'source_id': source_id,
         'order_items_code': order_items_code,
         'color': color,
         'print_sku': print_sku,
         'monogram_type': monogram_type,
         'letters': letters,
         'shadow': shadow,
         'front': front,
         'stripes': stripes
         }]

编辑以澄清:

在遍历整个对象后,数据将被添加到具有更新值的多个字典中: enter image description here


Tags: 对象idsource字典typecodeorderitems

热门问题