writing in a file as binary mode????

Terry Reedy tjreedy at udel.edu
Mon Sep 23 21:22:01 EDT 2002


<jubafre at brturbo.com> wrote in message
news:mailman.1032810110.30498.python-list at python.org...
>i open the a file for writing in a binary mode, but doesnt work

Depends what you mean by 'work'.  On *nix, *all* read/write is binary
mode.  On Win*, the *only* difference is conversion of \r\n to \n on
input and vice versa on output.

>just the "f.write('\x03AHM ')" work, i open the file in the notepad
and my file appears >like a text file and not as a binary file, i dont
know why??

*All* files are string of binary digits.  Notepad tries to interpret
any file as as extended-ASCII text file as best it can.

>>file.mem
>AHM 0020 0000x7 0030 0000x8 0010 0000x9 00F0 0003 0002 0000

>>i have the file like this, how??
>AHM  ? 0   f ð

That is how Notepad displays what it cannot properly interpret.

Terry J. Reedy





More information about the Python-list mailing list