Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #45531

Re: How to write fast into a file in python?

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 <fabiosantosart@gmail.com>
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 <hbkfp8dg7nlp08ticsv6gkmmt7k94c1od4@invalid.netcom.com>
References <e9dcd255-b892-40a0-ae6b-0995a61a270f@googlegroups.com> <87f9a3d4-427e-472f-bee7-9501ba842b36@googlegroups.com> <51961B73.2070401@davea.name> <mailman.1785.1368804103.3114.python-list@python.org> <51966d15$0$29997$c3e8da3$5496439d@news.astraweb.com> <BLU176-W2D076D16CF4457F289E40D7AC0@phx.gbl> <CAA=1kxRK3F3_gYGEecRkHS33e5nEHa1KQqAK0BeODty0RqJH5A@mail.gmail.com> <hbkfp8dg7nlp08ticsv6gkmmt7k94c1od4@invalid.netcom.com>
Date Sat, 18 May 2013 22:19:54 +0100
Subject Re: How to write fast into a file in python?
From Fábio Santos <fabiosantosart@gmail.com>
To Dennis Lee Bieber <wlfraed@ix.netcom.com>
Content-Type text/plain; charset=ISO-8859-1
Content-Transfer-Encoding quoted-printable
Cc "python-list@python.org" <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 <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.1820.1368912002.3114.python-list@python.org> (permalink)
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

Show key headers only | View raw


On 18 May 2013 20:19, "Dennis Lee Bieber" <wlfraed@ix.netcom.com> wrote:
>
> tOn Sat, 18 May 2013 08:49:55 +0100, Fábio Santos
> <fabiosantosart@gmail.com> declaimed the following in
> gmane.comp.python.general:
>
>
> > You mentioned "\n" translating to two lines, but this won't happen. Windows
> > 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 <cr> for "new line", I believe Apple used <lf>
> 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
> <cr><lf> is used, one could draw a vertical line of | by just spacing
> across the first line, printing |, then repeat <lf><bkspc>| until done.
> To do the same with conventional <lf> 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
<carlosnepomuceno@outlook.com> 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 <rosuav@gmail.com> 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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

How to write fast into a file in python? lokeshkoppaka@gmail.com - 2013-05-16 20:20 -0700
  Re: How to write fast into a file in python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-17 03:51 +0000
  Re: How to write fast into a file in python? lokeshkoppaka@gmail.com - 2013-05-16 21:35 -0700
    Re: How to write fast into a file in python? Dave Angel <davea@davea.name> - 2013-05-17 07:58 -0400
    RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-17 18:20 +0300
      Re: How to write fast into a file in python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-17 16:42 +0000
        RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-17 20:25 +0300
      Re: How to write fast into a file in python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-17 17:47 +0000
        RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-17 21:18 +0300
          Re: How to write fast into a file in python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-18 04:01 +0000
            Re: How to write fast into a file in python? Chris Angelico <rosuav@gmail.com> - 2013-05-18 15:28 +1000
            Re: How to write fast into a file in python? 88888 Dihedral <dihedral88888@googlemail.com> - 2013-05-18 04:09 -0700
        RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-17 21:33 +0300
        RE: How to write fast into a file in python? Fábio Santos <fabiosantosart@gmail.com> - 2013-05-18 08:49 +0100
        Re: How to write fast into a file in python? Chris Angelico <rosuav@gmail.com> - 2013-05-19 00:29 +1000
        RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-18 20:00 +0300
          Re: How to write fast into a file in python? Tim Roberts <timr@probo.com> - 2013-05-19 19:04 -0700
        Re: How to write fast into a file in python? Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2013-05-18 15:14 -0400
          Re: How to write fast into a file in python? Roy Smith <roy@panix.com> - 2013-05-18 15:37 -0400
          Re: How to write fast into a file in python? Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-05-18 22:23 +0000
        Re: How to write fast into a file in python? Fábio Santos <fabiosantosart@gmail.com> - 2013-05-18 22:19 +0100
        Re: How to write fast into a file in python? Dave Angel <davea@davea.name> - 2013-05-18 22:41 -0400
        RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-19 06:53 +0300
        Re: How to write fast into a file in python? MRAB <python@mrabarnett.plus.com> - 2013-05-19 16:44 +0100
        RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-20 13:34 +0300
    Re: How to write fast into a file in python? Dan Stromberg <drsalists@gmail.com> - 2013-05-18 12:38 -0700
    RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-19 08:31 +0300
    RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-19 08:42 +0300
    Re: How to write fast into a file in python? Chris Angelico <rosuav@gmail.com> - 2013-05-19 19:21 +1000
    RE: How to write fast into a file in python? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-05-19 12:41 +0300

csiph-web