Created
December 5, 2019 01:29
-
-
Save FerdinaKusumah/a928641c6388b4305561bb576c32a152 to your computer and use it in GitHub Desktop.
Transpose 2d list
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
"""Transpose 2d list""" | |
a = [["a", "b"], ["c", "d"], ["e", "f"]] | |
transposed = zip(*a) | |
to_list = list(transposed) | |
print("Transpose list from {} to {}".format(a, to_list)) | |
# Transpose list from [['a', 'b'], ['c', 'd'], ['e', 'f']] to [('a','c', 'e'), ('b', 'd', 'f')] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment