Skip to content

Commit 06a6532

Browse files
committed
gh-106318: Add example for str.format() with keyword argument
1 parent 3608c8c commit 06a6532

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Doc/library/stdtypes.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1933,6 +1933,8 @@ expression support in the :mod:`re` module).
19331933

19341934
>>> "The sum of 1 + 2 is {0}".format(1+2)
19351935
'The sum of 1 + 2 is 3'
1936+
>>> "The sum of {a} + {b} is {answer}".format(answer=1+2, a=1, b=2)
1937+
'The sum of 1 + 2 is 3'
19361938
>>> "{1} expects the {0} Inquisition!".format("Spanish", "Nobody")
19371939
'Nobody expects the Spanish Inquisition!'
19381940

0 commit comments

Comments
 (0)