This is a canonical zip example:
In [6]: inlist = [[1,2,3,4],[5,6,7,8],[9,10,11,12]] In [7]: out=zip(*inlist) In [8]: out Out[8]: [(1, 5, 9), (2, 6, 10), (3, 7, 11), (4, 8, 12)]
Or, to get a list of lists (rather than a list of tuples):
In [9]: out=[list(group) for group in zip(*inlist)] In [10]: out Out[10]: [[1, 5, 9], [2, 6, 10], [3, 7, 11], [4, 8, 12]]
source share