Text over multiple lines

John Roth newsgroups at jhrothjr.com
Sun Jun 20 15:44:23 CEST 2004

"Rigga" <Rigga at hasnomail.com> wrote in message
news:pan.2004. at hasnomail.com...
> Hi,
> I am using the HTMLParser to parse a web page, part of the routine I need
> to write (I am new to Python) involves looking for a particular tag and
> once I know the start and the end of the tag then to assign all the data
> in between the tags to a variable, this is easy if the tag starts and ends
> on the same line however how would I go about doing it if its split over
> two or more lines?
> Thanks

Depending on exactly what I want to do, I frequently use <file>.read()
to pick up the entire file in one string, rather than <file>.readlines() to
create a list of strings. It works quite well when what I need to do
can be served by regexs (which is not always the case.)

John Roth
> R

More information about the Python-list mailing list