Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!feeder.news-service.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!194.109.133.84.MISMATCH!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!newsgate.cistron.nl!newsgate.news.xs4all.nl!194.109.133.85.MISMATCH!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.009 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'mrab': 0.05; ':-)': 0.06; 'python': 0.08; 'from:addr:python': 0.09; 'wrote:': 0.15; 'from:addr:mrabarnett.plus.com': 0.16; 'from:name:mrab': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'received:84.92': 0.16; 'received:84.92.122': 0.16; 'received:84.92.122.60': 0.16; 'reply- to:addr:python-list': 0.16; '>>>': 0.16; 'header:In-Reply-To:1': 0.22; 'do,': 0.28; 'received:84': 0.28; 'list': 0.32; 'usually': 0.33; 'to:addr:python-list': 0.34; 'header:User-Agent:1': 0.34; 'reply-to:addr:python.org': 0.35; 'subject:Please': 0.37; 'subject:: ': 0.38; 'something': 0.38; 'help': 0.39; 'to:addr:python.org': 0.39; 'peter': 0.62; 'here:': 0.64; 'header :Reply-To:1': 0.71; 'reply-to:no real name:2**0': 0.72; 'otten': 0.84 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AsQHABJxH07Unw4S/2dsb2JhbABUmGSOe3eIfMMThjoEl2SLUg Date: Thu, 14 Jul 2011 23:47:36 +0100 From: MRAB User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.2.18) Gecko/20110616 Thunderbird/3.1.11 MIME-Version: 1.0 To: python-list@python.org Subject: Re: Please critique my script References: <77AE044B1BF3944FAE2435F395F11B4B01859CD7@clt-exmb02.bbtnet.com> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list Reply-To: python-list@python.org 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: 20 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1310683659 news.xs4all.nl 23890 [2001:888:2000:d::a6]:58471 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:9493 On 14/07/2011 21:53, Peter Otten wrote: > MRAB wrote: > >>> for line2 in nxxReg.findall(soup): >>> nxxlist.insert(count2, line2) >>> count2 = count2 + 1 >>> >> enumerate will help you here: > >> for count2, line2 in enumerate(nxxReg.findall(soup)): >> nxxlist.insert(count2, line2) > > An insert() at the end of a list is usually spelt append() in Python ;) > If you are looking for something less baroque > > nxxlist = nxxReg.findall(soup) > > will do, too. > That's true... :-)