Skip to content

Commit

Permalink
[Doc] Add doctest directive to an example in stdtypes
Browse files Browse the repository at this point in the history
Co-authored-by: Erlend E. Aasland <[email protected]>
  • Loading branch information
adorilson and erlend-aasland authored Mar 31, 2024
1 parent 640c833 commit d43d3a5
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2333,8 +2333,10 @@ String objects have one unique built-in operation: the ``%`` operator (modulo).
This is also known as the string *formatting* or *interpolation* operator.
Given ``format % values`` (where *format* is a string), ``%`` conversion
specifications in *format* are replaced with zero or more elements of *values*.
The effect is similar to using the :c:func:`sprintf` in the C language. For
example::
The effect is similar to using the :c:func:`sprintf` function in the C language.
For example:

.. doctest::

>>> print('%s has %d quote types.' % ('Python', 2))
Python has 2 quote types.
Expand Down

0 comments on commit d43d3a5

Please sign in to comment.