best way to take vertical slices from a matrix?

Remco Gerlich scarblac at pino.selwerd.nl
Thu Apr 26 12:48:01 EDT 2001


waldekO <osuchw at ecn.ab.ca.remove_me> wrote in comp.lang.python:
> one more way of doing it:
> 
> >>> x
> [(1, 2, 3), (4, 5, 6), (7, 8, 9)]
> >>> y = apply(zip,x)
> >>> y
> [(1, 4, 7), (2, 5, 8), (3, 6, 9)]

Or even
y = zip(*x)


-- 
Remco Gerlich



More information about the Python-list mailing list