write binary with struct.pack_into
Chris Angelico
rosuav at gmail.com
Sat Oct 6 09:52:47 EDT 2012
More information about the Python-list mailing list
Sat Oct 6 09:52:47 EDT 2012
- Previous message (by thread): write binary with struct.pack_into
- Next message (by thread): write binary with struct.pack_into
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sat, Oct 6, 2012 at 11:26 PM, Grant Edwards <invalid at invalid.invalid> wrote: > On 2012-10-06, Dennis Lee Bieber <wlfraed at ix.netcom.com> wrote: >> On Fri, 5 Oct 2012 20:27:36 -0700 (PDT), palmeira <palmeira at gmail.com> >> declaimed the following in gmane.comp.python.general: >> >>> >>> #WRITE >>> fb=open('testOUT.bin') >> >> Unless you specify otherwise, open() defaults to read-only > > It also defaults to 'text' mode which does cr/lf translaction. That > will break both reads and writes on any binary file containing 0x0a > and 0x0d bytes. And, in Python 3, it'll be returning Unicode characters too, unless the decode fails. You definitely want binary mode. ChrisA
- Previous message (by thread): write binary with struct.pack_into
- Next message (by thread): write binary with struct.pack_into
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list