Last active
January 5, 2018 10:14
-
-
Save adrianulbona/b4ac4768287d5572217c0a4eeb490da6 to your computer and use it in GitHub Desktop.
zip/unzip python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
numbers = (1, 2, 3) | |
chars = ('a', 'b', 'c') | |
numbers_chars = list(zip(numbers, chars)) | |
# [(1, 'a'), (2, 'b'), (3, 'c')] | |
unzipped_numbers, unzipped_chars = zip(*numbers_chars) | |
# ((1, 2, 3), ('a', 'b', 'c')) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment