Advertisement
here2share

# zip_parallel_iterate.py

Sep 7th, 2015
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.28 KB | None | 0 0
  1. # zip_parallel_iterate.py
  2.  
  3. aaa = [10,20,30,40,50]
  4. bbb = 'a b c d e'.split()
  5.  
  6. for a, b in zip(aaa, bbb): # zip stops when the shorter of any list stops
  7.     print(a, b)
  8. #
  9.  
  10. print
  11. ccc = 'xyz abc python happy 123 Wow!'.split()
  12.  
  13. for a, b, c in zip(aaa, bbb, ccc):
  14.     print(a, b, c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement