L1=['one','two','three']
L2=['1','2','3']
D=dict(zip(L2,L1)) #拼接列表,若元素个数不对应,默认为空,不会报错;
#L2列表元素为键,L1列表元素为值
print(D) #键值对输出字典
print(D.values()) #输出字典所有值
print(D.keys()) #输出字典所有键
print(D['1']) #输出键为'1'所对应的值
以下为相应的输出:
{'1': 'one', '2': 'two', '3': 'three'}
dict_values(['one', 'two', 'three'])
dict_keys(['1', '2', '3'])
one



