📜  列表到字典 python 代码示例

📅  最后修改于: 2022-03-11 14:45:38.413000             🧑  作者: Mango

代码示例3
#This is to convert two lists into a dictionary in Python

#given ListA is key
#given ListB is value

listA = ['itemA','itemB']
listB = ['priceA','priceB']
dict(zip(listA, listB))

# Returns 
{'itemA': 'priceA',
 'itemB': 'priceB'
}