file ops on the fly ?
Shagshag13
shagshag13 at yahoo.fr
Fri Jul 19 08:38:37 EDT 2002
"Alex Martelli" <aleax at aleax.it> a écrit dans le message de news: 21TZ8.101254$vm5.3505549 at news2.tin.it...
> Shagshag13 wrote:
>
> > hello,
> >
> > is it possible (and how) to do "on the fly" reading and updating on file ?
>
> You can open a file for 'r+b' and then call both read and write on it,
> moving around with seek and possibly tell. This is hardly ever useful
> on a text file, though. But I guess much depends on what you mean by
> "on the fly" in this context -- maybe the simulation of inplace edits
> for text files offered by standard module fileinput is all you need?
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.
s13.
More information about the Python-list
mailing list