Skip to content
Snippets Groups Projects
Unverified Commit 549567c6 authored by slateny's avatar slateny Committed by GitHub
Browse files

gh-80143: Add clarification for escape characters (#92292)

parent 4e6da502
No related branches found
No related tags found
No related merge requests found
......@@ -480,9 +480,11 @@ declaration is given in the source file; see section :ref:`encodings`.
In plain English: Both types of literals can be enclosed in matching single quotes
(``'``) or double quotes (``"``). They can also be enclosed in matching groups
of three single or double quotes (these are generally referred to as
*triple-quoted strings*). The backslash (``\``) character is used to escape
characters that otherwise have a special meaning, such as newline, backslash
itself, or the quote character.
*triple-quoted strings*). The backslash (``\``) character is used to give special
meaning to otherwise ordinary characters like ``n``, which means 'newline' when
escaped (``\n``). It can also be used to escape characters that otherwise have a
special meaning, such as newline, backslash itself, or the quote character.
See :ref:`escape sequences <escape-sequences>` below for examples.
.. index::
single: b'; bytes literal
......@@ -541,6 +543,8 @@ retained), except that three unescaped quotes in a row terminate the literal. (
single: \u; escape sequence
single: \U; escape sequence
.. _escape-sequences:
Unless an ``'r'`` or ``'R'`` prefix is present, escape sequences in string and
bytes literals are interpreted according to rules similar to those used by
Standard C. The recognized escape sequences are:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment