reading and removing first x bytes of a file

Peter Hansen peter at engcorp.com
Thu Apr 29 14:13:35 EDT 2004


Terry Reedy wrote:

> IF the remainder of the file fits in memory, then it can 'moved up' by
> rewriting same file after seeking to beginning of file.  Don't know how
> safe on MAC OSes (ie, degree to which write is atomic).  Of course, if data
> are important, one should have at least a few minutes of battery backup.

I think it's a fair assumption that when the OP asked for a "safe"
way, he meant at least safer than that.  If power failed in the
middle of the update, or a system crash occurred, the file could
well be unrecoverable...

-Peter



More information about the Python-list mailing list