Skip to content

Instantly share code, notes, and snippets.

@FerdinaKusumah
Created July 28, 2020 13:14
Show Gist options
  • Save FerdinaKusumah/2d79e0343357f640fd585a7e2e924d72 to your computer and use it in GitHub Desktop.
Save FerdinaKusumah/2d79e0343357f640fd585a7e2e924d72 to your computer and use it in GitHub Desktop.
[Python] Transpose List
"""Transpose 2D List"""
arr = [["a", "b"], ["b", "c"], ["d", "e"]]
transpose = list(zip(*arr))
print(f'Transpose list from {arr} to {transpose}')
# Transpose list from [['a', 'b'], ['b', 'c'], ['d', 'e']] to [('a', 'b', 'd'), ('b', 'c', 'e')]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment