Skip to content

Commit a71c48b

Browse files
adorilsondiegorusso
authored andcommitted
Doc: printf-style library/stdtype improvements (python#16741)
1 parent 1d78822 commit a71c48b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

Doc/library/stdtypes.rst

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2339,7 +2339,13 @@ String objects have one unique built-in operation: the ``%`` operator (modulo).
23392339
This is also known as the string *formatting* or *interpolation* operator.
23402340
Given ``format % values`` (where *format* is a string), ``%`` conversion
23412341
specifications in *format* are replaced with zero or more elements of *values*.
2342-
The effect is similar to using the :c:func:`sprintf` in the C language.
2342+
The effect is similar to using the :c:func:`sprintf` function in the C language.
2343+
For example:
2344+
2345+
.. doctest::
2346+
2347+
>>> print('%s has %d quote types.' % ('Python', 2))
2348+
Python has 2 quote types.
23432349

23442350
If *format* requires a single argument, *values* may be a single non-tuple
23452351
object. [5]_ Otherwise, *values* must be a tuple with exactly the number of

0 commit comments

Comments
 (0)