]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Update example; str(float) changed so there is difference now.
authorGeorg Brandl <georg@python.org>
Mon, 22 Feb 2016 13:52:55 +0000 (14:52 +0100)
committerGeorg Brandl <georg@python.org>
Mon, 22 Feb 2016 13:52:55 +0000 (14:52 +0100)
Doc/tutorial/inputoutput.rst

index 5314fedb6df9574ab87e22223fc9bc55bb72d13b..02bb28b11deced88b2fb772e6242d15b35e9c469 100644 (file)
@@ -152,11 +152,11 @@ Positional and keyword arguments can be arbitrarily combined::
 ``'!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.
+   >>> contents = 'eels'
+   >>> print('My hovercraft is full of {}.'.format(contents))
+   My hovercraft is full of eels.
+   >>> print('My hovercraft is full of {!r}.'.format(contents))
+   My hovercraft is full of 'eels'.
 
 An optional ``':'`` and format specifier can follow the field name. This allows
 greater control over how the value is formatted.  The following example