Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
ecd78feb
Commit
ecd78feb
authored
Aug 13, 2012
by
Andrew Svetlov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Issue #15624: clarify newline documentation for open and io.TextIOWrapper
Thanks to Chris Jerdonek
parent
1ef9caa2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
24 deletions
+30
-24
Doc/library/functions.rst
Doc/library/functions.rst
+15
-12
Doc/library/io.rst
Doc/library/io.rst
+15
-12
No files found.
Doc/library/functions.rst
View file @
ecd78feb
...
...
@@ -878,18 +878,21 @@ are always available. They are listed here in alphabetical order.
mode). It can be ``None``, ``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It
works as follows:
* On input, if *newline* is ``None``, universal newlines mode is enabled.
Lines in the input can end in ``'\n'``, ``'\r'``, or ``'\r\n'``, and these
are translated into ``'\n'`` before being returned to the caller. If it is
``''``, universal newline mode is enabled, but line endings are returned to
the caller untranslated. If it has any of the other legal values, input
lines are only terminated by the given string, and the line ending is
returned to the caller untranslated.
* On output, if *newline* is ``None``, any ``'\n'`` characters written are
translated to the system default line separator, :data:`os.linesep`. If
*newline* is ``''`` or ``'\n'``, no translation takes place. If *newline*
is any of the other legal values, any ``'\n'`` characters written are
* When reading input from the stream, if *newline* is ``None``,
universal newlines mode is enabled. Lines in the input can end
in ``'\n'``, ``'\r'``, or ``'\r\n'``, and these are translated
into ``'\n'`` before being returned to the caller. If it is
``''``, universal newline mode is enabled, but line endings are
returned to the caller untranslated. If it has any of the other
legal values, input lines are only terminated by the given
string, and the line ending is returned to the caller
untranslated.
* When writing output to the stream, if *newline* is ``None``, any
``'\n'`` characters written are translated to the system default
line separator, :data:`os.linesep`. If *newline* is ``''`` or
``'\n'``, no translation takes place. If *newline* is any of the
other legal values, any ``'\n'`` characters written are
translated to the given string.
If *closefd* is ``False`` and a file descriptor rather than a filename was
...
...
Doc/library/io.rst
View file @
ecd78feb
...
...
@@ -760,18 +760,21 @@ Text I/O
*newline* controls how line endings are handled. It can be ``None``,
``''``, ``'\n'``, ``'\r'``, and ``'\r\n'``. It works as follows:
* On input, if *newline* is ``None``, universal newlines mode is enabled.
Lines in the input can end in ``'\n'``, ``'\r'``, or ``'\r\n'``, and these
are translated into ``'\n'`` before being returned to the caller. If it is
``''``, universal newline mode is enabled, but line endings are returned to
the caller untranslated. If it has any of the other legal values, input
lines are only terminated by the given string, and the line ending is
returned to the caller untranslated.
* On output, if *newline* is ``None``, any ``'\n'`` characters written are
translated to the system default line separator, :data:`os.linesep`. If
*newline* is ``''`` or ``'\n'``, no translation takes place. If *newline*
is any of the other legal values, any ``'\n'`` characters written are
* When reading input from the stream, if *newline* is ``None``,
universal newlines mode is enabled. Lines in the input can end
in ``'\n'``, ``'\r'``, or ``'\r\n'``, and these are translated
into ``'\n'`` before being returned to the caller. If it is
``''``, universal newline mode is enabled, but line endings are
returned to the caller untranslated. If it has any of the other
legal values, input lines are only terminated by the given
string, and the line ending is returned to the caller
untranslated.
* When writing output to the stream, if *newline* is ``None``, any
``'\n'`` characters written are translated to the system default
line separator, :data:`os.linesep`. If *newline* is ``''`` or
``'\n'``, no translation takes place. If *newline* is any of the
other legal values, any ``'\n'`` characters written are
translated to the given string.
If *line_buffering* is ``True``, :meth:`flush` is implied when a call to
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment