Transposing Python Arrays
Friday, December 5, 2008 9:21:49 PM
>>> lst=[[1,2,3],[4,5,6],[7,8,9,10]] >>> print(list(map(lambda *x:x, *lst))) [(1, 4, 7), (2, 5, 8), (3, 6, 9), (None, None, 10)]
This works with Python 2.x and 3.x
Originally found at Muffin Research Labs, modified for Python 3 thanks to a blog comment (see below).







Unregistered user # Wednesday, March 16, 2011 6:51:32 PM
Unregistered user # Tuesday, March 22, 2011 10:35:10 PM