File tree Expand file tree Collapse file tree 1 file changed +5
-1
lines changed
Expand file tree Collapse file tree 1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -1927,10 +1927,14 @@ expression support in the :mod:`re` module).
19271927 ``{} ``. Each replacement field contains either the numeric index of a
19281928 positional argument, or the name of a keyword argument. Returns a copy of
19291929 the string where each replacement field is replaced with the string value of
1930- the corresponding argument.
1930+ the corresponding argument. For example:
1931+
1932+ .. doctest ::
19311933
19321934 >>> " The sum of 1 + 2 is {0} " .format(1 + 2 )
19331935 'The sum of 1 + 2 is 3'
1936+ >>> " {1} expects the {0} Inquisition!" .format(" Spanish" , " Nobody" )
1937+ 'Nobody expects the Spanish Inquisition!'
19341938
19351939 See :ref: `formatstrings ` for a description of the various formatting options
19361940 that can be specified in format strings.
You can’t perform that action at this time.
0 commit comments