We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ed4cc6f commit 3608c8cCopy full SHA for 3608c8c
1 file changed
Doc/library/stdtypes.rst
@@ -1927,10 +1927,14 @@ expression support in the :mod:`re` module).
1927
``{}``. Each replacement field contains either the numeric index of a
1928
positional argument, or the name of a keyword argument. Returns a copy of
1929
the string where each replacement field is replaced with the string value of
1930
- the corresponding argument.
+ the corresponding argument. For example:
1931
+
1932
+ .. doctest::
1933
1934
>>> "The sum of 1 + 2 is {0}".format(1+2)
1935
'The sum of 1 + 2 is 3'
1936
+ >>> "{1} expects the {0} Inquisition!".format("Spanish", "Nobody")
1937
+ 'Nobody expects the Spanish Inquisition!'
1938
1939
See :ref:`formatstrings` for a description of the various formatting options
1940
that can be specified in format strings.
0 commit comments