best way to take vertical slices from a matrix?

mary mary.stern at virgin.net
Tue Apr 24 19:04:09 EDT 2001


I have a simple problem and am interested to find
the 'best' way to do this in python:

Given a list such as:

x[0] = (1,2,3)
x[1] = (4,5,6)
x[2] = (7,8,9)

what's the best way to 'take vertical slices' from this
matrix, ie end up with:

y[0] = (1,4,7)
y[1] = (2,5,8)
y[2] = (3,6,9)

Cheers!
Tushar.





More information about the Python-list mailing list