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.001 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'from:addr:yahoo.co.uk': 0.04; 'iterate': 0.09; 'lawrence': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.11; 'suggest': 0.14; 'dict': 0.16; 'iterated': 0.16; 'iterkeys': 0.16; 'keys.': 0.16; 'prog': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'renamed': 0.16; 'subject: ?': 0.16; 'wrote:': 0.18; 'header :User-Agent:1': 0.23; 'url:moin': 0.24; 'header:X-Complaints- To:1': 0.27; 'header:In-Reply-To:1': 0.27; 'function': 0.29; 'returned': 0.30; 'url:wiki': 0.31; 'url:python': 0.33; 'but': 0.35; 'shows': 0.36; 'possible': 0.36; 'url:org': 0.36; 'error.': 0.37; 'to:addr:python-list': 0.38; 'to:addr:python.org': 0.39; 'received:org': 0.40; 'read': 0.60; 'subject:Can': 0.60; "you're": 0.61; 'address': 0.63; 'charset:windows-1252': 0.65; 'subject:over': 0.84 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Mark Lawrence Subject: Re: Can I iterate over a dictionary outside a function ? Date: Thu, 11 Apr 2013 12:53:06 +0100 References: Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 8bit X-Gmane-NNTP-Posting-Host: host-92-18-43-197.as13285.net User-Agent: Mozilla/5.0 (Windows NT 6.0; rv:17.0) Gecko/20130328 Thunderbird/17.0.5 In-Reply-To: X-Antivirus: avast! (VPS 130411-0, 11/04/2013), Outbound message X-Antivirus-Status: Clean 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: 19 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1365681127 news.xs4all.nl 2705 [2001:888:2000:d::a6]:48846 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:43354 On 11/04/2013 10:48, inshu chauhan wrote: > I have a prog in which a functions returns a dict but when I try to > iterate over the dict using iterkeys, It shows an error. I think its > because only address of the dictionary is returned so cannot be iterated > upon. > > Please suggest some way by which it can be made possible to iterate over > the dictionary using iterkeys outside the function ? > > If you're using Python 3 iterkeys has been renamed keys. -- If you're using GoogleCrap™ please read this http://wiki.python.org/moin/GoogleGroupsPython. Mark Lawrence