[Tutor] HTML Parsing

bob gailer bgailer at gmail.com
Mon Apr 21 19:07:05 CEST 2008


Stephen Nelson-Smith wrote:
> Hi,
>
>   
>>  for lineno, line in enumerate(html):
>>     
>
> -Epython2.2hasnoenumerate()
>
>   
I used enumerate for a marginal (unproven) performance enhancement.
> Can we code around this?
for lineno in range(len(html)):
  x = html[lineno].find("requests/sec")
  if x >= 0:
    no_requests_sec = html[lineno].[3:x]
   break
for lineno in range(lineno, len(html)):
  x = html[lineno].find("requests currently being processed")
  if x >= 0:
    no_connections = html[lineno][3:x]
    break

-- 
Bob Gailer
919-636-4239 Chapel Hill, NC



More information about the Tutor mailing list