Skip to content

Instantly share code, notes, and snippets.

@vlad-bezden
Created October 25, 2019 10:25
Show Gist options
  • Save vlad-bezden/e5dcb9f8743b67dd7892a7aec946ac53 to your computer and use it in GitHub Desktop.
Save vlad-bezden/e5dcb9f8743b67dd7892a7aec946ac53 to your computer and use it in GitHub Desktop.
Splits iterable by pairs.
print(*zip(*[iter(range(20)] * 2))
# output
# (0, 1) (2, 3) (4, 5) (6, 7) (8, 9) (10, 11) (12, 13) (14, 15) (16, 17) (18, 19)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment