tallying occurrences in list

Paul Rubin no.email at nospam.invalid
Sat Jun 5 14:00:25 EDT 2010


Sreenivas Reddy Thatiparthy <thatiparthysreenivas at gmail.com> writes:
> How about this one liner, if you prefer them;
> set([(k,yourList.count(k)) for k in yourList])

That has a rather bad efficiency problem if the list is large.



More information about the Python-list mailing list