Posted By

magicrebirth on 12/22/09


Tagged

zip


Versions (?)

Zip function


 / Published in: Python
 

  1. >>> x = [1, 2, 3]
  2. >>> y = [4, 5, 6]
  3. >>> zipped = zip(x, y)
  4. >>> zipped
  5. [(1, 4), (2, 5), (3, 6)]
  6. >>> x2, y2 = zip(*zipped)
  7. >>> x == x2, y == y2
  8. True

Report this snippet  

You need to login to post a comment.