summaryrefslogtreecommitdiffstats
path: root/Doc/tutorial
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2011-03-06 09:56:18 (GMT)
committerGeorg Brandl <georg@python.org>2011-03-06 09:56:18 (GMT)
commitcdbc6967e863aa9f636ac70823d7531cd1d7efd2 (patch)
tree32ab8333932aca49ba93f8989b81dbcc2b87096f /Doc/tutorial
parentc9497ba06e29a21c46f1881eaed2251d10b358bc (diff)
downloadcpython-cdbc6967e863aa9f636ac70823d7531cd1d7efd2.zip
cpython-cdbc6967e863aa9f636ac70823d7531cd1d7efd2.tar.gz
cpython-cdbc6967e863aa9f636ac70823d7531cd1d7efd2.tar.bz2
#11405: do not reference the string module again for its deprecated functions, only for Template class.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r--Doc/tutorial/inputoutput.rst7
1 files changed, 4 insertions, 3 deletions
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index 0e04962..ca908a3 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -19,16 +19,17 @@ the :keyword:`print` statement. (A third way is using the :meth:`write` method
of file objects; the standard output file can be referenced as ``sys.stdout``.
See the Library Reference for more information on this.)
-.. index:: module: string
-
Often you'll want more control over the formatting of your output than simply
printing space-separated values. There are two ways to format your output; the
first way is to do all the string handling yourself; using string slicing and
concatenation operations you can create any layout you can imagine. The
-standard module :mod:`string` contains some useful operations for padding
+string types have some methods that perform useful operations for padding
strings to a given column width; these will be discussed shortly. The second
way is to use the :meth:`str.format` method.
+The :mod:`string` module contains a :class:`~string.Template` class which offers
+yet another way to substitute values into strings.
+
One question remains, of course: how do you convert values to strings? Luckily,
Python has ways to convert any value to a string: pass it to the :func:`repr`
or :func:`str` functions.