File reading using delimiters

Kylotan kylotan at
Mon Jun 9 17:52:08 CEST 2003

All the examples of reading files in Python seem to concern reading a
line at a time. But this is not much good to me as I want to be able
to read up to arbitrary delimiters without worrying about how many
lines I'm spanning. With my rudimentary Python knowledge I'm having to
read in multiple lines, concatenate them, search for the delimiter,
split the result if necessary, and carry forward whatever was after
the delimiter to the next operation. Is there a better way of reading
until a certain character is encountered, and no more?

More information about the Python-list mailing list