python 中zip函数的使用

1.
ta = [1,2,3] tb = [9,8,7] tc = ['a','b','c'] for (a,b,c) in zip(ta,tb,tc): print(a,b,c)

2.

ta = [1,2,3]
tb = [9,8,7]

# cluster
zipped = zip(ta,tb)
print(zipped)

# decompose
na, nb = zip(*zipped)
print(na, nb)

posted on 2016-10-09 16:34  猫儿爹  阅读(4081)  评论(0编辑  收藏  举报

导航