diff options
author | Adorilson Bezerra <adorilson@gmail.com> | 2024-03-31 22:34:54 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-31 22:34:54 (GMT) |
commit | 56e99307c49adcc6df355f8070229371c97d654f (patch) | |
tree | 7fd9783548ccd61506dda7b0f2c2617fa71e2eed /Doc | |
parent | 18e12641a61a88f7d08b2114ebe965892c6661c5 (diff) | |
download | cpython-56e99307c49adcc6df355f8070229371c97d654f.zip cpython-56e99307c49adcc6df355f8070229371c97d654f.tar.gz cpython-56e99307c49adcc6df355f8070229371c97d654f.tar.bz2 |
Doc: printf-style library/stdtype improvements (#16741)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/stdtypes.rst | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst index c963519..62fc109 100644 --- a/Doc/library/stdtypes.rst +++ b/Doc/library/stdtypes.rst @@ -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 |