Re: reading file objects in chunks

2007-11-12 Thread Marc 'BlackJack' Rintsch
On Mon, 12 Nov 2007 17:47:29 +0100, Martin Marcher wrote: > I'd really like something nicer than > > chunksize = 26 > f = file("datafile.dat", buffering=chunksize) > > chunk = f.read(chunksize) > while len(chunk) == chunksize: > compute_data(chunk) > f.read(chunksize) > > I just don't feel

reading file objects in chunks

2007-11-12 Thread Martin Marcher
Hi, I'm looking for something that will give me an iterator to a file-(like)-object. I have large files with only a single line in it that have fixed length fields like, record length is 26bytes, dataA is 10 bytes, dataB is 16 bytes. Now when I made my parsing stuff but can't find anything that w