001、方法1
>>> list1 = ["aaa", "bbb", "ccc"] >>> list2 = [100, 500, 300] >>> dict1 = dict(zip(list1, list2)) >>> dict1 {'aaa': 100, 'bbb': 500, 'ccc': 300}
002、方法2
>>> list1 = ["xxx", "zzz", "bbb"] >>> list2 = [300, 100, 500] >>> dict1 = dict() >>> for i in range(len(list1)): ... dict1[list1[i]] = list2[i] ... >>> dict1 {'xxx': 300, 'zzz': 100, 'bbb': 500}
标签:dict1,python,list1,bbb,list2,300,列表,500,字典 From: https://www.cnblogs.com/liujiaxin2018/p/16843783.html