Delete items in nested dictionary based on value.

bearophileHUGS at lycos.com bearophileHUGS at lycos.com
Thu Sep 14 02:10:00 CEST 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