Created
September 18, 2014 02:01
-
-
Save SZanlongo/60612f01fcdd48d6545d to your computer and use it in GitHub Desktop.
Transpose iterable
This file contains 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
# https://stackoverflow.com/questions/691946/short-and-useful-python-snippets | |
a = [[1, 2, 3], [4, 5, 6]] | |
print zip(*a) | |
# Same with dicts | |
d = {"a":1, "b":2, "c":3} | |
print zip(*d.iteritems()) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment