两个列表合成字典
2018-01-17 本文已影响16人
夕阳下的不回头
L1 = ['a','b']
L2 = [1,2]
adct = dict(zip(L1, L2))#方法一
adct=dict(map(lambda x,y:[x,y],L1,L2))#方法二
print(adct)
L1 = ['a','b']
L2 = [1,2]
adct = dict(zip(L1, L2))#方法一
adct=dict(map(lambda x,y:[x,y],L1,L2))#方法二
print(adct)