Editing a Binary File.

Paradox JoeyTaj at netzero.com
Mon Jun 9 16:03:25 CEST 2003

Jp Calderone <exarkun at intarweb.us> wrote in message news:<mailman.1055141177.5862.python-list at python.org>...
> On Sun, Jun 08, 2003 at 11:37:24PM -0700, Paradox wrote:
> > I need to edit a few bytes in an existing binary file. Is this
> > possible with the Python file object or if not what is another way
> > that I can accomplish this?
> > I am running Python 2.2 under Windows.
> > 
> > I have tried using open(fileName, 'a+b') and open(fileName, 'w+b').
> > 
> > With a+ I have not been able to write anywhere but to the end of the
> > file and with w+ it destroys my file.
> > 
>   Try the mode 'r+b', I think you will find it to your liking.
>   Jp


I just didn't even read the r capabilities cause I thought they were
for readonly access.


More information about the Python-list mailing list