Commit ab2dc1d7 authored by Fred Drake's avatar Fred Drake

Added index entries similar to some recommended by Skip, and used the word

"interpolation" in the text, to make the string formatting material easier to
find.
This closes SF bug #487165.
Bugfix: this should be applied for Python 2.2.1.
parent 3d422662
...@@ -681,20 +681,24 @@ Return a copy of the string converted to uppercase. ...@@ -681,20 +681,24 @@ Return a copy of the string converted to uppercase.
\subsubsection{String Formatting Operations \label{typesseq-strings}} \subsubsection{String Formatting Operations \label{typesseq-strings}}
\index{formatting, string (\%{})} \index{formatting, string (\%{})}
\index{interpolation, string (\%{})}
\index{string!formatting} \index{string!formatting}
\index{string!interpolation}
\index{printf-style formatting} \index{printf-style formatting}
\index{sprintf-style formatting} \index{sprintf-style formatting}
\index{\protect\%{} formatting} \index{\protect\%{} formatting}
\index{\protect\%{} interpolation}
String and Unicode objects have one unique built-in operation: the String and Unicode objects have one unique built-in operation: the
\code{\%} operator (modulo). Given \code{\var{format} \% \code{\%} operator (modulo). This is also known as the string
\var{values}} (where \var{format} is a string or Unicode object), \emph{formatting} or \emph{interpolation} operator. Given
\code{\%} conversion specifications in \var{format} are replaced with \code{\var{format} \% \var{values}} (where \var{format} is a string or
zero or more elements of \var{values}. The effect is similar to the Unicode object), \code{\%} conversion specifications in \var{format}
using \cfunction{sprintf()} in the C language. If \var{format} is a are replaced with zero or more elements of \var{values}. The effect
Unicode object, or if any of the objects being converted using the is similar to the using \cfunction{sprintf()} in the C language. If
\code{\%s} conversion are Unicode objects, the result will be a \var{format} is a Unicode object, or if any of the objects being
Unicode object as well. converted using the \code{\%s} conversion are Unicode objects, the
result will be a Unicode object as well.
If \var{format} requires a single argument, \var{values} may be a If \var{format} requires a single argument, \var{values} may be a
single non-tuple object. \footnote{A tuple object in this case should single non-tuple object. \footnote{A tuple object in this case should
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment