zip() or what?

Erik Max Francis max at alcyone.com
Thu Jul 3 00:45:15 EDT 2003


Ray Tomes wrote:

> What I really wanted was this:
> 
> [[0.1,1.1,2.1],[0.2,1.2,2.2]]
> 
> So my question is how do I do that easily?

You wanted

	zip(*x)

> Alternatively, is there a construct to get x[*][i] if you know what I
> mean?

Probably

	[i[1] for i in x]

or

	map(lambda i: i[1], x)

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ What would physics look like without gravitation?
\__/  Albert Einstein




More information about the Python-list mailing list