File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -2339,7 +2339,13 @@ String objects have one unique built-in operation: the ``%`` operator (modulo).
23392339This is also known as the string *formatting * or *interpolation * operator.
23402340Given ``format % values `` (where *format * is a string), ``% `` conversion
23412341specifications 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
23442350If *format * requires a single argument, *values * may be a single non-tuple
23452351object. [5 ]_ Otherwise, *values * must be a tuple with exactly the number of
You can’t perform that action at this time.
0 commit comments