The zip function using the python

 

>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> z = [7, 8, 9]
>>> xyz = list(zip(x, y, z))
>>> unxyz=zip(*xyz)
>>> print(xyz)
[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
>>> print(list(unxyz))
[(1, 2, 3), (4, 5, 6), (7, 8, 9)]
>>> 

 

Guess you like

Origin www.cnblogs.com/sea-stream/p/11246350.html