[prev in list] [next in list] [prev in thread] [next in thread] 

List:       python-3000
Subject:    [Python-3000] Some notes on newline conversion.
From:       "Alexandre Vassalotti" <alexandre () peadrop ! com>
Date:       2007-12-28 7:19:26
Message-ID: acd65fa20712272319q7a10c94j87fbb92e6588a4f4 () mail ! gmail ! com
[Download RAW message or body]

Hi,

I had a hard time, earlier today, figuring out what was the rules for
converting newline characters (only from the code of
io.TextIOWrapper). So, I wrote some notes for myself. I don't know if
there's any documentation about this yet -- that is why am posting my
notes to the list. Free it to use them for whatever you want to.

Cheers,
-- Alexandre


Known newline type:
  LF: \n or "universal newline"
  CRLF: \r\n
  CR: \r

Argument |
value    | Notes
---------+-------------------------------------------------------
None     | Default mode for open().
         | LF are converted to the value of os.linesep on writes.
         | Convert any known newline type to LF on reads.
         | Readline splits on LF.
---------+-------------------------------------------------------
""       | No conversions on writes.
         | No conversions on reads.
         | Readline splits on any known newline type.
---------+-------------------------------------------------------
LF       | Default mode for StringIO.
         | No conversions on writes.
         | No conversions on reads.
         | Readline splits on LF.
---------+-------------------------------------------------------
CRLF     | Convert LF to CRLF on writes.
         | No conversions on reads.
         | Readline splits on CRLF.
---------+-------------------------------------------------------
CR       | Convert LF to CR on writes.
         | No conversions on reads.
         | Readline splits on CR.
---------+-------------------------------------------------------
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: http://mail.python.org/mailman/options/python-3000/python-3000%40progressive-comp.com
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic