Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder1.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed6.news.xs4all.nl!xs4all!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.003 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'beating': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:80.91.229.12': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'received:lo.gmane.org': 0.09; 'subject:don': 0.09; 'received:173.11': 0.16; 'skip:# 60': 0.16; 'edward': 0.16; 'this:': 0.16; '>>>': 0.16; 'subject:list': 0.16; 'figure': 0.21; 'subject:not': 0.21; 'header:In-Reply-To:1': 0.22; 'trying': 0.23; 'example': 0.30; 'print': 0.32; 'list': 0.32; "i've": 0.33; 'to:addr:python-list': 0.34; 'header:X-Complaints- To:1': 0.34; 'header:User-Agent:1': 0.34; 'received:org': 0.38; 'subject:: ': 0.38; 'should': 0.39; 'header:Mime-Version:1': 0.39; 'data': 0.39; 'to:addr:python.org': 0.39; 'format': 0.40; 'skip:l 50': 0.67; 'subject:good': 0.93; 'subject:know': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Emile van Sebille Subject: Re: I don't know list, I not good at list. Date: Wed, 13 Jul 2011 14:51:38 -0700 References: <77AE044B1BF3944FAE2435F395F11B4B018599C6@clt-exmb02.bbtnet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: 173-11-108-137-sfba.hfc.comcastbusiness.net User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.18) Gecko/20110616 Lightning/1.0b2 Thunderbird/3.1.11 In-Reply-To: <77AE044B1BF3944FAE2435F395F11B4B018599C6@clt-exmb02.bbtnet.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 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: 25 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310593833 news.xs4all.nl 23879 [2001:888:2000:d::a6]:51061 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9448 On 7/13/2011 2:13 PM Ellerbee, Edward said... > I've been beating my head against the desk trying to figure out a method > to accomplish this: > > #----------------------------------------------------------------- > My intent is to have the end data come out (from the example list above) > in the format of > 25220[56] > 25224[678] this should get you started... >>> list1=['252205','252246','252206','252247','252248'] >>> D = {} >>> for ii in list1: D.setdefault(ii[:5],[]).append(ii[5]) ... >>> print D {'25224': ['6', '7', '8'], '25220': ['5', '6']} >>> Emile