【发布时间】:2022-06-17 22:31:48
【问题描述】:
我想将列表列表转换为字典,其中每个子列表都是字典中的键值 例如
array = [[a,b],[c,d],[e,f]]
我想要这样的输出
dict = { a:b,c:d,e:f }
【问题讨论】:
标签: python python-3.x dictionary
我想将列表列表转换为字典,其中每个子列表都是字典中的键值 例如
array = [[a,b],[c,d],[e,f]]
我想要这样的输出
dict = { a:b,c:d,e:f }
【问题讨论】:
标签: python python-3.x dictionary
dct = {x[0]: x[1] for x in array}
【讨论】: