Skip to content

Commit 969876e

Browse files
committed
Doc: Clarify newline escaping in triple-quoted strings (#160886)
Clarify that unescaped newlines are preserved in triple-quoted strings and that `"\<newline>"` omits them in non-raw string literals. Retain string literal concatenation as an alternative.
1 parent 87c0c35 commit 969876e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎Doc/reference/lexical_analysis.rst‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,8 @@ sequences, and more details.
676676
single: """; string literal
677677
single: '''; string literal
678678

679+
.. _triple-quoted-strings:
680+
679681
Triple-quoted strings
680682
---------------------
681683

@@ -838,8 +840,10 @@ A backslash can be added at the end of a line to ignore the newline::
838840
... backslashes or newline characters.'
839841
'This string will not include backslashes or newline characters.'
840842

841-
The same result can be achieved using :ref:`triple-quoted strings <strings>`,
842-
or parentheses and :ref:`string literal concatenation <string-concatenation>`.
843+
The same escape sequence can be used in non-raw
844+
:ref:`triple-quoted strings <triple-quoted-strings>`.
845+
Alternatively, the same result can be achieved using parentheses and
846+
:ref:`string literal concatenation <string-concatenation>`.
843847

844848
.. _string-escape-escaped-char:
845849

0 commit comments

Comments
 (0)