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
8218bd4c
Commit
8218bd4c
authored
Mar 31, 2015
by
Benjamin Peterson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
document what exactly str.splitlines() splits on (closes #12855)
Patch by Martin Panter.
parent
b9100e5d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
4 deletions
+36
-4
Doc/library/stdtypes.rst
Doc/library/stdtypes.rst
+36
-4
No files found.
Doc/library/stdtypes.rst
View file @
8218bd4c
...
...
@@ -1855,10 +1855,42 @@ expression support in the :mod:`re` module).
.. method:: str.splitlines([keepends])
Return a list of the lines in the string, breaking at line boundaries.
This method uses the :term:`universal newlines` approach to splitting lines.
Line breaks are not included in the resulting list unless *keepends* is
given and true.
Return a list of the lines in the string, breaking at line boundaries. Line
breaks are not included in the resulting list unless *keepends* is given and
true.
This method splits on the following line boundaries. In particular, the
boundaries are a superset of :term:`universal newlines`.
+-----------------------+-----------------------------+
| Representation | Description |
+=======================+=============================+
| ``\n`` | Line Feed |
+-----------------------+-----------------------------+
| ``\r`` | Carriage Return |
+-----------------------+-----------------------------+
| ``\r\n`` | Carriage Return + Line Feed |
+-----------------------+-----------------------------+
| ``\v`` or ``\x0b`` | Line Tabulation |
+-----------------------+-----------------------------+
| ``\f`` or ``\x0c`` | Form Feed |
+-----------------------+-----------------------------+
| ``\x1c`` | File Separator |
+-----------------------+-----------------------------+
| ``\x1d`` | Group Separator |
+-----------------------+-----------------------------+
| ``\x1e`` | Record Separator |
+-----------------------+-----------------------------+
| ``\x85`` | Next Line (C1 Control Code) |
+-----------------------+-----------------------------+
| ``\u2028`` | Line Separator |
+-----------------------+-----------------------------+
| ``\u2029`` | Paragraph Separator |
+-----------------------+-----------------------------+
.. versionchanged:: 3.2
``\v`` and ``\f`` added to list of line boundaries.
For example::
...
...
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