SyntaxFix
Write A Post
Hire A Developer
Questions
One way to do it is with NumPy transpose. For a list, a:
>>> import numpy as np >>> np.array(a).T.tolist() [[1, 4, 7], [2, 5, 8], [3, 6, 9]]
Or another one without zip:
>>> map(list,map(None,*a)) [[1, 4, 7], [2, 5, 8], [3, 6, 9]]