Path: csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed2.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.008 X-Spam-Evidence: '*H*': 0.98; '*S*': 0.00; 'lines,': 0.07; 'subject:file': 0.07; 'advance': 0.07; 'corrections': 0.09; 'happen.': 0.09; 'mess': 0.09; 'spaces': 0.09; 'subject:into': 0.09; 'terminated': 0.09; 'subject:How': 0.10; 'cc:addr:python- list': 0.11; 'python': 0.11; 'windows': 0.15; '"new': 0.16; '6:00': 0.16; 'carriage': 0.16; 'left,': 0.16; 'macs': 0.16; 'newlines': 0.16; 'simplicity,': 0.16; 'spacing': 0.16; 'subject:python': 0.16; 'apps': 0.16; 'files.': 0.16; 'sat,': 0.16; 'wrote:': 0.18; 'cc:addr:python.org': 0.22; 'file.': 0.24; 'cc:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'chris': 0.29; 'character': 0.29; 'unix': 0.29; 'dos': 0.30; 'mode': 0.30; 'message-id:@mail.gmail.com': 0.30; 'lines': 0.31; '+0100,': 0.31; 'follows': 0.31; 'mod': 0.31; 'vertical': 0.31; 'yes.': 0.31; 'file': 0.32; 'text': 0.33; 'cases': 0.33; 'used,': 0.33; 'could': 0.34; 'done.': 0.35; 'but': 0.35; 'received:google.com': 0.35; 'add': 0.35; 'there': 0.35; 'really': 0.36; 'thanks': 0.36; 'subject:?': 0.36; 'two': 0.37; 'apple': 0.38; 'convention': 0.38; 'feed': 0.38; 'machines': 0.38; 'writes': 0.38; 'pm,': 0.38; 'track': 0.38; 'ability': 0.39; 'moving': 0.39; 'days': 0.60; 'length': 0.61; 'lost': 0.61; 'mentioned': 0.61; 'took': 0.61; 'first': 0.61; 'back': 0.62; 'stand': 0.64; 'world': 0.66; 'believe': 0.68; 'line,': 0.68; 'repeat': 0.74; 'paper': 0.75; 'account.': 0.80; '(while': 0.84; 'characters,': 0.84; 'delay.': 0.84; 'carlos': 0.91; '2013': 0.98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type:content-transfer-encoding; bh=rdFKmeJBIzY7Wl8it2n/bSbpMkYY36xFzyTMqvc1/sQ=; b=nY+l4BW5+Tr3r5FbtEtNNjYmncOenLd+VHTsXyvRPZ2IShQpO8nL6FI8u5pAGz0hVY y4QBqn132DkXrhx7wyzisSqlLrFfYRIZHn2jhNOW1+7rn3JkvkSf0P7GsNKJUu2zQafG 4ARyH2HWBMoLCuv9zj7PwU7+BHNTwdfNKnzmhgJ8GQCUBsoJK+bbGi1pFlKrYS2fP4Kz G381dBAxmMcl1iJ9/rZv2XlX3sLie8xXz1MCgcMN1PaaxyfkDFcPggmhBl0yhZwR0+iy bu6+jUi5JS53ilERRtYMqfAwys1xsgFEnr4IQjtzMo7JmKzJx//2aeFXeRBY0GbfJSBy ri3w== MIME-Version: 1.0 X-Received: by 10.49.35.243 with SMTP id l19mr48920511qej.56.1368911994640; Sat, 18 May 2013 14:19:54 -0700 (PDT) In-Reply-To: References: <87f9a3d4-427e-472f-bee7-9501ba842b36@googlegroups.com> <51961B73.2070401@davea.name> <51966d15$0$29997$c3e8da3$5496439d@news.astraweb.com> Date: Sat, 18 May 2013 22:19:54 +0100 Subject: Re: How to write fast into a file in python? From: =?ISO-8859-1?Q?F=E1bio_Santos?= To: Dennis Lee Bieber Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Cc: "python-list@python.org" 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: 53 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1368912002 news.xs4all.nl 15940 [2001:888:2000:d::a6]:56896 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:45531 On 18 May 2013 20:19, "Dennis Lee Bieber" wrote: > > tOn Sat, 18 May 2013 08:49:55 +0100, F=E1bio Santos > declaimed the following in > gmane.comp.python.general: > > > > You mentioned "\n" translating to two lines, but this won't happen. Win= dows > > will not mess with what you write to your file. It's just that > > traditionally windows and windows programs use \r\n instead of just \n.= I > > think it was for compatibility with os/2 or macintosh (I don't remember > > which), which used \r for newlines. > > > Neither... It goes back to Teletype machines where one sent a > carriage return to move the printhead back to the left, then sent a line > feed to advance the paper (while the head was still moving left), and in > some cases also provided a rub-out character (a do-nothing) to add an > additional character time delay. > > TRS-80 Mod 1-4 used for "new line", I believe Apple used > for "new line"... And both lost the ability to move down the page > without also resetting the carriage to the left. In a world where both > is used, one could draw a vertical line of | by just spacing > across the first line, printing |, then repeat | until done. > To do the same with conventional is "new line/return" one has to > transmit all those spaces for each line... > > At 300baud, that took time.... On Sat, May 18, 2013 at 6:00 PM, Carlos Nepomuceno wrote: > Python really writes '\n\r' on Windows. Just check the files. > > Internal representations only keep '\n' for simplicity, but if you wanna = keep track of the file length you have to take that into account. ;) On Sat, May 18, 2013 at 3:29 PM, Chris Angelico wrote: > Into two characters, not two lines, but yes. A file opened in text > mode on Windows will have its lines terminated with two characters. > (And it's old Macs that used to use \r. OS/2 follows the DOS > convention of \r\n, but again, many apps these days are happy with > Unix newlines there too.) > > ChrisA Thanks for your corrections and explanations. I stand corrected and have learned something.