Recorded merge of revisions 74614 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r74614 | georg.brandl | 2009-09-01 09:40:54 +0200 (Di, 01 Sep 2009) | 1 line

  #6813: better documentation for numberless string formats.
........
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index 549a922..dbb56f6 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -126,12 +126,12 @@
 
 Basic usage of the :meth:`str.format` method looks like this::
 
-   >>> print('We are the {0} who say "{1}!"'.format('knights', 'Ni'))
+   >>> print('We are the {} who say "{}!"'.format('knights', 'Ni'))
    We are the knights who say "Ni!"
 
 The brackets and characters within them (called format fields) are replaced with
-the objects passed into the :meth:`~str.format` method.  The number in the
-brackets refers to the position of the object passed into the
+the objects passed into the :meth:`~str.format` method.  A number in the
+brackets can be used to refer to the position of the object passed into the
 :meth:`~str.format` method. ::
 
    >>> print('{0} and {1}'.format('spam', 'eggs'))
@@ -152,6 +152,15 @@
                                                           other='Georg'))
    The story of Bill, Manfred, and Georg.
 
+``'!a'`` (apply :func:`ascii`), ``'!s'`` (apply :func:`str`) and ``'!r'``
+(apply :func:`repr`) can be used to convert the value before it is formatted::
+
+   >>> import math
+   >>> print('The value of PI is approximately {}.'.format(math.pi))
+   The value of PI is approximately 3.14159265359.
+   >>> print('The value of PI is approximately {!r}.'.format(math.pi))
+   The value of PI is approximately 3.141592653589793.
+
 An optional ``':'`` and format specifier can follow the field name. This allows
 greater control over how the value is formatted.  The following example
 truncates Pi to three places after the decimal.