Reading variable length records...

Markus Schaber markus at schabi.de
Thu Sep 13 04:07:18 EDT 2001


Hi,

Bjorn Pettersen <BPettersen at NAREX.com> schrub:

> I'm trying to read records from a 2 GB datafile, but my brain has
> stopped working, so I was wondering if someone has allready solved
> this problem. The records are variable length and are separated by a
> five character delimiter. I was trying to use file.read(n) with a
> blocksize of ~1Mb, but got a serious brainfart when trying to think of
> how to handle the case where only part of the delimiter was read in
> the current block.

Hmm - maybe a rewind of the file could help you.

-- 
"The strength of the Constitution lies entirely in the determination of 
each citizen to defend it. Only if every single citizen feels duty 
bound to do his share in this defense are the constitutional rights 
secure." -- Albert Einstein



More information about the Python-list mailing list