Reading variable length records...

Bjorn Pettersen BPettersen at NAREX.com
Wed Sep 12 19:32:13 EDT 2001


> From: Brian Quinlan [mailto:BrianQ at ActiveState.com]
> 
> > 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.
> 
> Here is some pseudo-code to get you started:
> 

Thanks, that helps alot :-)

-- bjorn




More information about the Python-list mailing list