Delete items in nested dictionary based on value.

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Wed Sep 13 20:10:00 EDT 2006


Fuzzyman:
> Can you delete values from a dictionary whilst iterating over its items ?

Try the code, it works. I am not iterating on the dict, I am not using
dict.iteritems(), that produces a lazy iterable, I am using
dict.items() that produces a list of (key,value) pairs. And I am not
removing elements from that list :-)

Hugs,
bearophile




More information about the Python-list mailing list