Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.052 X-Spam-Evidence: '*H*': 0.90; '*S*': 0.00; 'referring': 0.07; 'cc:addr :python-list': 0.10; 'cc:name:python list': 0.16; 'key/value': 0.16; 'wrote:': 0.17; 'creates': 0.18; 'bit': 0.21; 'regardless': 0.21; 'cc:2**0': 0.23; 'cc:addr:python.org': 0.25; 'header:In- Reply-To:1': 0.25; 'to?': 0.27; 'message-id:@mail.gmail.com': 0.27; 'this?': 0.28; 'post': 0.28; 'depth': 0.29; 'dictionary': 0.29; 'subject:some': 0.29; 'e.g.': 0.30; 'code': 0.31; 'december': 0.32; 'structure': 0.32; 'could': 0.32; 'received:google.com': 0.34; 'received:209.85': 0.35; 'something': 0.35; 'there': 0.35; 'really': 0.36; 'received:209': 0.37; 'data': 0.37; 'subject:: ': 0.38; 'mean': 0.38; 'some': 0.38; 'delete': 0.38; 'short': 0.39; 'header:Received:5': 0.40; 'kind': 0.61; 'clearer': 0.84; 'oscar': 0.84; 'mean.': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=gOJjBxsIi7yZbE3RwSovKlY+/Ydu18A69wxWGZByzFs=; b=pZ7DWUGT6cOL7qo9ICAWh10usJYhaON1ZFaooNl8bJaYjY00cfKLlfhShutkgHdkZr 3uVoAdEfDbq6rp/yKPeNnFJEfbUktJ+3pwhiy/ppcogfbC4sYvrizjGB2d25eQE+pCey VkTGP7hmafJQt6qCDH/aAeyDUMShkXz2CHNw5zSBvLtBOYIe+eCANPxb2Apk4zh6kJ+w z0PdfHYU7kqHdv99GIkjuAea2AE8mWZC7GtM2l7zd4bc3mNkrCKX+8sbVyV5aJZoAcre wrot1YiCmGT73iI+JABjbYOaoXTktcmpGXoKbhIrgY6g3e5Siicja/U41iBH7NPKZs2f drng== MIME-Version: 1.0 In-Reply-To: <943dbf16-1cd1-4844-a666-d8863f5941f8@googlegroups.com> References: <943dbf16-1cd1-4844-a666-d8863f5941f8@googlegroups.com> Date: Mon, 17 Dec 2012 17:42:26 +0000 Subject: Re: Delete dict and subdict items of some name From: Oscar Benjamin To: Gnarlodious Content-Type: text/plain; charset=ISO-8859-1 Cc: Python List X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1355766148 news.xs4all.nl 6872 [2001:888:2000:d::a6]:54783 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:34996 On 17 December 2012 17:27, 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? 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