python 列表转为字典的小方法
现在有两个列表,list1 = ['key1','key2','key3']和list2 = ['1','2','3']
把他们转为这样的字典:{'key1':'1','key2':'2','key3':'3'}
list1 = ['key1','key2','key3']
list2 = ['1','2','3']
dict(zip(list1,list2))
结果
{'key1':'1','key2':'2','key3':'3'}
现在有两个列表,list1 = ['key1','key2','key3']和list2 = ['1','2','3']
把他们转为这样的字典:{'key1':'1','key2':'2','key3':'3'}
list1 = ['key1','key2','key3']
list2 = ['1','2','3']
dict(zip(list1,list2))
结果
{'key1':'1','key2':'2','key3':'3'}