Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit f1d371b

Browse files
committed
Update example; str(float) changed so there is difference now.
1 parent 6fe57ad commit f1d371b

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Doc/tutorial/inputoutput.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -152,11 +152,11 @@ Positional and keyword arguments can be arbitrarily combined::
152152
``'!a'`` (apply :func:`ascii`), ``'!s'`` (apply :func:`str`) and ``'!r'``
153153
(apply :func:`repr`) can be used to convert the value before it is formatted::
154154

155-
>>> import math
156-
>>> print('The value of PI is approximately {}.'.format(math.pi))
157-
The value of PI is approximately 3.14159265359.
158-
>>> print('The value of PI is approximately {!r}.'.format(math.pi))
159-
The value of PI is approximately 3.141592653589793.
155+
>>> contents = 'eels'
156+
>>> print('My hovercraft is full of {}.'.format(contents))
157+
My hovercraft is full of eels.
158+
>>> print('My hovercraft is full of {!r}.'.format(contents))
159+
My hovercraft is full of 'eels'.
160160

161161
An optional ``':'`` and format specifier can follow the field name. This allows
162162
greater control over how the value is formatted. The following example

0 commit comments

Comments
 (0)