Doc: printf-style library/stdtype improvements (#16741)

This commit is contained in:
Adorilson Bezerra 2024-03-31 23:34:54 +01:00 committed by GitHub
parent 18e12641a6
commit 56e99307c4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 7 additions and 1 deletions

View File

@ -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