Delete dict and subdict items of some name

Oscar Benjamin oscar.j.benjamin at gmail.com
Mon Dec 17 12:42:26 EST 2012


On 17 December 2012 17:27, Gnarlodious <gnarlodious at gmail.com> wrote:
> Hello. What I want to do is delete every dictionary key/value of the name 'Favicon' regardless of depth in subdicts, of which there are many. What is the best way to do it?

You might need to be a bit clearer about what you mean by subdicts. I
don't really know what you mean.

Could you perhaps post some short code that creates the kind of data
structure you are referring to?

e.g. Do you mean something like this?

d = {
    'a': {'b': 'Favicon'},
    'b': {'c': 'Favicon'},
}


Oscar



More information about the Python-list mailing list