Making a file-like object for manipulating a large file
Lawrence D'Oliveiro
ldo at geek-central.gen.new_zealand
Sun Aug 26 05:55:37 EDT 2007
In message <1187920825.457886.7880 at q4g2000prc.googlegroups.com>, Sean Davis
wrote:
> I have a VERY large file that I would
> like to load a line at a time, do some manipulations on it, and then
> make it available to as a file-like object for use as input to a
> database module (psycopg2) that wants a file-like object (with read
> and readlines methods). I could write the manipulated file out to
> disk and then read it back in, but that seems wasteful.
If your consumer doesn't need to seek, how about having it read from a pipe?
More information about the Python-list
mailing list