overwrite bytes in file

Oleg Broytmann phd at phd.pp.ru
Wed Mar 27 13:11:07 CET 2002

On Wed, Mar 27, 2002 at 01:05:47PM +0000, Marcus Stojek wrote:
> how can I overwrite certain bytes in a file (Win NT) and
> keep the rest unchanged.

   Just open the file, seek to some position and start writing.

> All open options are truncating the file.

   No, not all. Use "open(filename, 'rb+')".

     Oleg Broytmann            http://phd.pp.ru/            phd at phd.pp.ru
           Programmers don't die, they just GOSUB without RETURN.

More information about the Python-list mailing list