[Numpy-discussion] Working with lists

volker lorrmann@physik.uni-wuerzburg...
Thu Aug 9 08:54:21 CDT 2007


Nils Wagner <nwagner <at> iam.uni-stuttgart.de> writes:

> 
> Hi all,
> 
> I have a list e.g.
> >>> bounds
> [(1950.0, 2100.0), (1800.0, 1850.0), (1600.0, 1630.0), (1400.0, 1420.0),
> (1200.0, 1210.0), (990, 1018.0), (10, 12), (12.0, 14.0), (14.0, 16.0),
> (16.0, 18.0), (18.0, 20)]
> 
> How can I extract the first value of each pair given in parenthesis i.e.
> 1950,1800,1600,1400,... ?
> 
> Nils
> 

Its easy i think:

bounds_0 = (array(bounds)[:,0]).tolist()


volker



More information about the Numpy-discussion mailing list