Skip to content

Instantly share code, notes, and snippets.

@miku
Created April 26, 2014 14:53
Show Gist options
  • Save miku/11322135 to your computer and use it in GitHub Desktop.
Save miku/11322135 to your computer and use it in GitHub Desktop.
Iterate over subsequent pairs with zip.
>>> l = [1, 2, 3, 4, 5]
>>> zip(l[:-1], l[1:])
[(1, 2), (2, 3), (3, 4), (4, 5)]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment