On 12/17/2012 12:27 PM, Gnarlodious 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?

-- Gnarlie

Something like this should work:

def delkey(d, key):
    if isinstance(d, dict):
        if key in d: del d[key]
        for val in d.values():
            delkey(val, key)


--
Lark's Tongue Guide to Python: http://lightbird.net/larks/

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to