Created
August 1, 2020 14:32
-
-
Save ephsmith/82a3aa7d57c2f017d139cd59c03515ff to your computer and use it in GitHub Desktop.
Transpose a 2D Python 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
m = [[1,2,3],[4,5,6],[7,8,9]] | |
m_t = list(map(list,zip(*m))) | |
# m_t is now -> [[1,4,7], [2,5,8], [3,6,9]] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment