【发布时间】:2018-03-18 15:26:21
【问题描述】:
我有一个列表列表,我正在尝试从列表中制作字典。我知道如何使用这种方法来做到这一点。 Creating a dictionary with list of lists in Python
我要做的是使用第一个列表中的元素作为键来构建列表,其余具有相同索引的项目将是值列表。但我不知道从哪里开始。每个列表的长度相同,但列表的长度不同
exampleList = [['first','second','third'],['A','B','C'], ['1','2','3']]
resultDict = {'first':['A','1'],'second':['B','2'],'third':['C','3']}
【问题讨论】:
标签: python dictionary dictionary-comprehension