mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
Issue #13748: Raw bytes literals can now be written with the rb
prefix as well as br
.
This commit is contained in:
parent
b63a450cc4
commit
3a5d4cb940
6 changed files with 54 additions and 19 deletions
|
@ -412,7 +412,7 @@ String literals are described by the following lexical definitions:
|
|||
|
||||
.. productionlist::
|
||||
bytesliteral: `bytesprefix`(`shortbytes` | `longbytes`)
|
||||
bytesprefix: "b" | "B" | "br" | "Br" | "bR" | "BR"
|
||||
bytesprefix: "b" | "B" | "br" | "Br" | "bR" | "BR" | "rb" | "rB" | "Rb" | "RB"
|
||||
shortbytes: "'" `shortbytesitem`* "'" | '"' `shortbytesitem`* '"'
|
||||
longbytes: "'''" `longbytesitem`* "'''" | '"""' `longbytesitem`* '"""'
|
||||
shortbytesitem: `shortbyteschar` | `bytesescapeseq`
|
||||
|
@ -446,6 +446,10 @@ or ``'R'``; such strings are called :dfn:`raw strings` and treat backslashes as
|
|||
literal characters. As a result, in string literals, ``'\U'`` and ``'\u'``
|
||||
escapes in raw strings are not treated specially.
|
||||
|
||||
.. versionadded:: 3.3
|
||||
The ``'rb'`` prefix of raw bytes literals has been added as a synonym
|
||||
of ``'br'``.
|
||||
|
||||
In triple-quoted strings, unescaped newlines and quotes are allowed (and are
|
||||
retained), except that three unescaped quotes in a row terminate the string. (A
|
||||
"quote" is the character used to open the string, i.e. either ``'`` or ``"``.)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue