Newbie here... getting a count of repeated instances in a list.

Peter Otten __peter__ at web.de
Mon Nov 24 17:56:08 EST 2003


Amy G wrote:

> Not sure that I actually have two dictionaries.  I am setting
> 
> domains_black = filter_domains2(domain_histogram, threshold)
> 
> I thought this would return a dictionary, but apparently it is a list.
> How do I perform this operation on the dictionary?

domains_black = dict(filter_domains2(domain_histogram, threshold))

filter_domains2() returns a list of (domain, frequency) tuples, and the
dict() constructor is quite happy with it.

Seriously, consider learning the language. I like the tutorial a lot, but 
there are other online resources that you might investigate.

Peter





More information about the Python-list mailing list