list subsetting

Paul Rubin http
Wed Jan 21 17:44:28 EST 2009


culpritNr1 <ig2ar-saf1 at yahoo.co.uk> writes:
> Anyway. More than counting, I am interested in list subsetting in a simple
> way. Forget about counting. Say I have a list of lists and I want to pull
> only the rows where the second "column" equals 3.14.

list_of_lists = [[1.414,2.718,3.14],[4.00,3.14,1.618],[72,29,39]]
those_rows = [xs for xs in list_of_lists if xs[1] == 3.14]



More information about the Python-list mailing list