Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f4e21a2

Browse files
KatherineMichelMariatta
authored andcommitted
Improve the F-strings and format specifier documentation (GH-4931)
Mention that the format-specifier mini language in f-strings is the same one used by str.format.
1 parent f7686c1 commit f4e21a2

1 file changed

Lines changed: 5 additions & 4 deletions

File tree

Doc/reference/lexical_analysis.rst

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -654,10 +654,11 @@ expression or conversion result. An empty string is passed when the
654654
format specifier is omitted. The formatted result is then included in
655655
the final value of the whole string.
656656

657-
Top-level format specifiers may include nested replacement fields.
658-
These nested fields may include their own conversion fields and
659-
:ref:`format specifiers <formatspec>`, but may not include more
660-
deeply-nested replacement fields.
657+
Top-level format specifiers may include nested replacement fields. These nested
658+
fields may include their own conversion fields and :ref:`format specifiers
659+
<formatspec>`, but may not include more deeply-nested replacement fields. The
660+
:ref:`format specifier mini-language <formatspec>` is the same as that used by
661+
the string .format() method.
661662

662663
Formatted string literals may be concatenated, but replacement fields
663664
cannot be split across literals.

0 commit comments

Comments
 (0)