Python 从两个List构造Dict
code
>>> l1=[1,2,3,4,5,6] >>> l2=[4,5,6,7,8,9] >>> print(dict(zip(l1,l2))) {1: 4, 2: 5, 3: 6, 4: 7, 5: 8, 6: 9}
code
>>> l1=[1,2,3,4,5,6] >>> l2=[4,5,6,7,8,9] >>> print(dict(zip(l1,l2))) {1: 4, 2: 5, 3: 6, 4: 7, 5: 8, 6: 9}