Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.xs4all.nl!newsfeed4a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.000 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'binary': 0.07; "'a'": 0.09; 'differently.': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'subject:files': 0.09; 'windows,': 0.09; 'python': 0.11; 'jan': 0.12; '"\\r\\n"': 0.16; "'b'": 0.16; "'r'": 0.16; "'rb')": 0.16; "'w'": 0.16; 'file).': 0.16; 'mode,': 0.16; 'newlines': 0.16; 'received:80.91.229.3': 0.16; 'received:plane.gmane.org': 0.16; 'reedy': 0.16; 'subject:program': 0.16; 'applies': 0.16; 'wrote:': 0.18; 'thu,': 0.19; 'platforms': 0.22; 'header:User-Agent:1': 0.23; 'specify': 0.24; 'least': 0.26; 'header:X-Complaints-To:1': 0.27; 'header:In- Reply-To:1': 0.27; 'chris': 0.29; 'mode': 0.30; 'sep': 0.31; 'universal': 0.31; 'text': 0.33; 'open': 0.33; 'convert': 0.35; 'subject:data': 0.36; 'to:addr:python-list': 0.38; 'files': 0.38; 'pm,': 0.38; 'does': 0.39; 'sure': 0.39; 'to:addr:python.org': 0.39; 'skip:p 20': 0.39; 'received:org': 0.40; 'ensure': 0.60; '2014,': 0.84; 'received:fios.verizon.net': 0.84; 'received:108': 0.93 X-Injected-Via-Gmane: http://gmane.org/ To: python-list@python.org From: Terry Reedy Subject: Re: program to generate data helpful in finding duplicate large files Date: Mon, 22 Sep 2014 19:06:10 -0400 References: <1411414443.4182630.170466465.768582FE@webmail.messagingengine.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Gmane-NNTP-Posting-Host: pool-108-16-203-145.phlapa.fios.verizon.net User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 In-Reply-To: <1411414443.4182630.170466465.768582FE@webmail.messagingengine.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 18 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1411427213 news.xs4all.nl 2954 [2001:888:2000:d::a6]:54563 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:78186 On 9/22/2014 3:34 PM, random832@fastmail.us wrote: > On Thu, Sep 18, 2014, at 14:45, Chris Kaynor wrote: >> Additionally, you may want to specify binary mode by using >> open(file_path, >> 'rb') to ensure platform-independence ('r' uses Universal newlines, which >> means on Windows, Python will convert "\r\n" to "\n" while reading the >> file). Additionally, some platforms will treat binary files differently. > > Does 'r' not use universal newlines on unix? 'r' in the open mode means 'read', versus 'w' for 'write' and 'a' for 'append'. 'b' means 'binary', versus 't' for 'text'. I am pretty sure universal newlines only applies to text mode, as least in 3.x. -- Terry Jan Reedy