python中的zip函数的使用

 

>>> 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)]
>>> 

 

posted @ 2019-07-25 19:14  anobscureretreat  阅读(325)  评论(0编辑  收藏  举报