@@ -447,9 +447,11 @@ see section :ref:`encodings`.
447
447
In plain English: Both types of literals can be enclosed in matching single quotes
448
448
(``' ``) or double quotes (``" ``). They can also be enclosed in matching groups
449
449
of three single or double quotes (these are generally referred to as
450
- *triple-quoted strings *). The backslash (``\ ``) character is used to escape
451
- characters that otherwise have a special meaning, such as newline, backslash
452
- itself, or the quote character.
450
+ *triple-quoted strings *). The backslash (``\ ``) character is used to give special
451
+ meaning to otherwise ordinary characters like ``n ``, which means 'newline' when
452
+ escaped (``\n ``). It can also be used to escape characters that otherwise have a
453
+ special meaning, such as newline, backslash itself, or the quote character.
454
+ See :ref: `escape sequences <escape-sequences >` below for examples.
453
455
454
456
.. index ::
455
457
single: b'; bytes literal
@@ -508,6 +510,8 @@ retained), except that three unescaped quotes in a row terminate the literal. (
508
510
single: \u ; escape sequence
509
511
single: \U ; escape sequence
510
512
513
+ .. _escape-sequences :
514
+
511
515
Unless an ``'r' `` or ``'R' `` prefix is present, escape sequences in string and
512
516
bytes literals are interpreted according to rules similar to those used by
513
517
Standard C. The recognized escape sequences are:
0 commit comments