Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.glorb.com!news-out.readnews.com!transit4.readnews.com!panix!not-for-mail From: Grant Edwards Newsgroups: comp.lang.python Subject: Re: write binary with struct.pack_into Date: Sat, 6 Oct 2012 13:26:44 +0000 (UTC) Organization: PANIX Public Access Internet and UNIX, NYC Lines: 16 Message-ID: References: <1349494056881-4991234.post@n6.nabble.com> NNTP-Posting-Host: c-24-118-110-103.hsd1.mn.comcast.net Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Trace: reader1.panix.com 1349530004 6991 24.118.110.103 (6 Oct 2012 13:26:44 GMT) X-Complaints-To: abuse@panix.com NNTP-Posting-Date: Sat, 6 Oct 2012 13:26:44 +0000 (UTC) User-Agent: slrn/0.9.9p1 (Linux) Xref: csiph.com comp.lang.python:30889 On 2012-10-06, Dennis Lee Bieber wrote: > On Fri, 5 Oct 2012 20:27:36 -0700 (PDT), palmeira > 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