Please critique my script

MRAB python at mrabarnett.plus.com
Thu Jul 14 18:47:36 EDT 2011


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... :-)



More information about the Python-list mailing list