a = [1,2,3,4]
b = ['a','b','c','d']
c = dict(zip(a,b))
print(c)
'''
当不匹配时候自动舍去
'''
a = [1,2,3,4]
b = ['a','b','c','d','e']
c = dict(zip(a,b))
print(c)
a = [1,2,3,4,5]
b = ['a','b','c','d']
c = dict(zip(a,b))
print(c)
运行结果
{1: 'a', 2: 'b', 3: 'c', 4: 'd'}
{1: 'a', 2: 'b', 3: 'c', 4: 'd'}
{1: 'a', 2: 'b', 3: 'c', 4: 'd'}