objects have one unique built-in operation: the
%operator (modulo) with a string left argument
interprets this string as a C
string to be applied to the right argument and returns the string
resulting from this formatting operation.
The right argument should be a tuple with one item for each argument
required by the format string; if the string requires a single
argument, the right argument may also be a single nontuple
object. The following format characters are
Width and precision may be a
* to specify that an
integer argument specifies the actual width or precision. The flag
0 are understood. The size specifiers
may be present but are ignored. The
takes any Python object and converts it to a string using
str() before formatting it. The ANSI features
supported. Since Python strings have an explicit length,
%s conversions don’t assume that
\0 is the end of the string.
For safety reasons, floating-point precisions are clipped to 50;
%f conversions for numbers whose absolute value is
1e25 are replaced by
conversions. All other errors raise exceptions.
If the right argument is a dictionary (or any kind of mapping), the
formats in the string must have a parenthesized key into that
dictionary inserted immediately after the
% character, and each format then formats the corresponding entry from the mapping. ...