【发布时间】:2019-11-13 19:54:06
【问题描述】:
我有一个将数据存储在列表中的程序。 current 和 desired 输出格式为:
# Current Input
[{'Devices': ['laptops', 'tablets'],
'ParentCategory': ['computers', 'computers']},
{'Devices': ['touch'], 'ParentCategory': ['phones']}]
# Desired Output
[{'Devices': ['laptops', 'tablets','touch'],
'ParentCategory': ['computers', 'computers','phones']}]
您能告诉我如何将列表与另一行 python 代码或逻辑组合以获得所需的输出吗?
【问题讨论】: