The python zip and dict function

The zip is two iterators tuple into arrays, each array element is a pair of values ​​corresponding to two iterator,

a=[1,2,3]
b=[4,5,6]
C = ZIP (A, B)
 Print (C)
 # C = [(1,2), (3,4-), (5,6)] is the actual value #c 
B = dict (C)
 Print (B )

Export

<zip object at 0x000001A384621648>
{1: 4, 2: 5, 3: 6}

dict is to convert the tuple array into a dictionary

Guess you like

Origin www.cnblogs.com/mghhzAnne/p/12513727.html