Skip to content

Instantly share code, notes, and snippets.

@lambdaman2
Created October 1, 2012 12:48
Show Gist options
  • Save lambdaman2/3811594 to your computer and use it in GitHub Desktop.
Save lambdaman2/3811594 to your computer and use it in GitHub Desktop.
Python: Zip function
>>> x = [1, 2, 3]
>>> y = [4, 5, 6]
>>> zipped = zip(x, y)
>>> zipped
[(1, 4), (2, 5), (3, 6)]
>>> x2, y2 = zip(*zipped)
>>> x == x2, y == y2
True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment