merge 3.4 (#12855)
This commit is contained in:
commit
f8521d55ad
|
@ -1855,10 +1855,42 @@ expression support in the :mod:`re` module).
|
||||||
|
|
||||||
.. method:: str.splitlines([keepends])
|
.. method:: str.splitlines([keepends])
|
||||||
|
|
||||||
Return a list of the lines in the string, breaking at line boundaries.
|
Return a list of the lines in the string, breaking at line boundaries. Line
|
||||||
This method uses the :term:`universal newlines` approach to splitting lines.
|
breaks are not included in the resulting list unless *keepends* is given and
|
||||||
Line breaks are not included in the resulting list unless *keepends* is
|
true.
|
||||||
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::
|
For example::
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue