Note that literal closing curly braces must be doubled.
This commit is contained in:
parent
fdb0cd2f08
commit
4e860330f6
|
@ -187,8 +187,10 @@ Once tokenized, f-strings are parsed in to literal strings and
|
||||||
expressions. Expressions appear within curly braces ``'{'`` and
|
expressions. Expressions appear within curly braces ``'{'`` and
|
||||||
``'}'``. While scanning the string for expressions, any doubled
|
``'}'``. While scanning the string for expressions, any doubled
|
||||||
braces ``'{{'`` or ``'}}'`` inside literal portions of an f-string are
|
braces ``'{{'`` or ``'}}'`` inside literal portions of an f-string are
|
||||||
replaced by the corresponding single brace. Doubled opening braces do
|
replaced by the corresponding single brace. Doubled literal opening
|
||||||
not signify the start of an expression.
|
braces do not signify the start of an expression. A single closing
|
||||||
|
curly brace ``'}'`` in the literal portion of a string is an error:
|
||||||
|
literal closing curly braces must be doubled ``'}}'``.
|
||||||
|
|
||||||
The parts of the f-string outside of braces are literal
|
The parts of the f-string outside of braces are literal
|
||||||
strings. These literal portions are then decoded. For non-raw
|
strings. These literal portions are then decoded. For non-raw
|
||||||
|
|
Loading…
Reference in New Issue