a_list.count(a_callable) ?

Ping ping.nsr.yeh at gmail.com
Sun Jun 17 18:49:23 CEST 2007


> print "b has", b.count(25, cmp=le, key=attrgetter("age")), \
>         "elements with age <= 25."
> [deleted]
> b has 2 elements with age <= 30.

Oops, I mixed up when copying and pasting at different times... :p
The output was of course

b has 1 elements with age <= 25.

Ping




More information about the Python-list mailing list