Skip to content

Commit

Permalink
Doc: printf-style library/stdtype improvements (python#16741)
Browse files Browse the repository at this point in the history
  • Loading branch information
adorilson authored Mar 31, 2024
1 parent 18e1264 commit 56e9930
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion Doc/library/stdtypes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2339,7 +2339,13 @@ 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.
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.

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

0 comments on commit 56e9930

Please sign in to comment.