Skip to content

Commit

Permalink
merge with 3.5
Browse files Browse the repository at this point in the history
  • Loading branch information
birkenfeld committed Feb 22, 2016
2 parents 72f2ef4 + f1d371b commit 2d43bc2
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Doc/tutorial/inputoutput.rst
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,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
Expand Down

0 comments on commit 2d43bc2

Please sign in to comment.