basic question: target assignment in for loop

Rene Pijlman reageer.in at de.nieuwsgroep
Mon Feb 24 10:50:05 CET 2003


Kawaldeep Grewal:
>for line in html:
>       line = re.sub("regexString", functionReturningString, line),

A 'line' is not a syntactical construct in HTML. Are you sure
whatever you're looking for cannot span multiple lines?

Why don't you just read the entire file in a string? That may
solve both problems.

Also, why don't you use the HTMLParser() module to do the
parsing for you?

-- 
René Pijlman

Wat wil jij leren?  http://www.leren.nl




More information about the Python-list mailing list