how to add a string to the beginning of a large binary file?
fredrik at pythonware.com
Mon Mar 28 12:16:14 CEST 2005
"could ildg" <could.net at gmail.com> wrote:
> I just want to know how to manipulate a large file and insert or
> delete some stuff in it.
you cannot insert or delete stuff in files in contemporary operating systems;
all you can do is to overwrite parts of the file, or add/remove stuff at the end
of the file.
to change a file in any other way, you have to create a new file (either by
loading the old file into memory, or by copying the contents of the old file
to a new temporary file, and removing/renaming the files when you're done)
More information about the Python-list