https://github.com/python/cpython/commit/56e99307c49adcc6df355f8070229371c97d654f
commit: 56e99307c49adcc6df355f8070229371c97d654f
branch: main
author: Adorilson Bezerra <[email protected]>
committer: erlend-aasland <[email protected]>
date: 2024-03-31T22:34:54Z
summary:
Doc: printf-style library/stdtype improvements (#16741)
files:
M Doc/library/stdtypes.rst
diff --git a/Doc/library/stdtypes.rst b/Doc/library/stdtypes.rst
index c963519f164dd2..62fc10997fc5b5 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
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]