python 迭代多个对象

并行迭代  zip

for a,b,c in zip(list,list,tuple,list):

  print a,b,c

串行迭代  itertools.chain

a = [1,2,3,4,5]

b = [2,3,4,5,6]

for x in chain(a,b):

  print x

猜你喜欢

转载自www.cnblogs.com/pxfb/p/9270616.html