file ops on the fly ?

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Fri Jul 19 08:57:32 EDT 2002


----- Original Message -----
From: "Shagshag13" <shagshag13 at yahoo.fr>
Newsgroups: comp.lang.python
>
> thanks, i'm going to look at fileinput...
>
> ans yes i'm working on big file (>1go). From a sequential reading (line by
line) i need to do line insertion and/or line deletion in
> my file. And i don't wish to create a new (wasting place) file.

It can't be done.  Line deletion can be done using a
dual-file-pointer algorithm, but if you can't load the
dataset into RAM you can't do insertions without copying
to another file.

Ur.  Maybe it can.  If you buffer a few lines ahead,
rewriting them as you go...

I'm not even going to try to write the code for that.
It's giving me a headache.

Chris Gonnerman -- chris.gonnerman at newcenturycomputers.net
http://newcenturycomputers.net






More information about the Python-list mailing list