culpritNr1 wrote:
Thank you Fogelbird and Jeff.
I actually tried to find out if such function existed. I did
help("count")
no Python documentation found for 'count'
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.
In [1]: list_o_lists = [[1, 3.14, 3, 4],
...: [2, 3, 4, 5],
...: [3, 3.14, 5, 6]]
In [2]: print [L for L in list_o_lists if L[1] == 3.14]
[[1, 3.1400000000000001, 3, 4], [3, 3.1400000000000001, 5, 6]]
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
--
http://mail.python.org/mailman/listinfo/python-list