write binary with struct.pack_into

Grant Edwards invalid at invalid.invalid
Sat Oct 6 09:26:44 EDT 2012


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.

-- 
Grant



More information about the Python-list mailing list