Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #9493
| Date | 2011-07-14 23:47 +0100 |
|---|---|
| From | MRAB <python@mrabarnett.plus.com> |
| Subject | Re: Please critique my script |
| References | <77AE044B1BF3944FAE2435F395F11B4B01859CD7@clt-exmb02.bbtnet.com> <mailman.1033.1310670724.1164.python-list@python.org> <ivnkvv$jnn$1@solani.org> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.1040.1310683659.1164.python-list@python.org> (permalink) |
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... :-)
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
Re: Please critique my script MRAB <python@mrabarnett.plus.com> - 2011-07-14 20:12 +0100
Re: Please critique my script Peter Otten <__peter__@web.de> - 2011-07-14 22:53 +0200
Re: Please critique my script MRAB <python@mrabarnett.plus.com> - 2011-07-14 23:47 +0100
csiph-web