Discussion:
[Python-3000-checkins] r65254 - in python/branches/py3k: Doc/tutorial/inputoutput.rst
benjamin.peterson
2008-07-26 22:27:05 UTC
Permalink
Author: benjamin.peterson
Date: Sun Jul 27 00:27:04 2008
New Revision: 65254

Log:
Merged revisions 65253 via svnmerge from
svn+ssh://pythondev at svn.python.org/python/trunk

........
r65253 | georg.brandl | 2008-07-26 17:13:29 -0500 (Sat, 26 Jul 2008) | 2 lines

Shorten some overlong lines.
........


Modified:
python/branches/py3k/ (props changed)
python/branches/py3k/Doc/tutorial/inputoutput.rst

Modified: python/branches/py3k/Doc/tutorial/inputoutput.rst
==============================================================================
--- python/branches/py3k/Doc/tutorial/inputoutput.rst (original)
+++ python/branches/py3k/Doc/tutorial/inputoutput.rst Sun Jul 27 00:27:04 2008
@@ -146,12 +146,14 @@
If keyword arguments are used in the format method, their values are referred to
by using the name of the argument. ::

- >>> print('This {food} is {adjective}.'.format(food='spam', adjective='absolutely horrible'))
+ >>> print('This {food} is {adjective}.'.format(
+ ... food='spam', adjective='absolutely horrible'))
This spam is absolutely horrible.

Positional and keyword arguments can be arbitrarily combined::

- >>> print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred', other='Georg'))
+ >>> print('The story of {0}, {1}, and {other}.'.format('Bill', 'Manfred',
+ other='Georg'))
The story of Bill, Manfred, and Georg.

An optional ``':``` and format specifier can follow the field name. This also
@@ -179,7 +181,8 @@
table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
- >>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; Dcab: {0[Dcab]:d}'.format(table))
+ >>> print('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '
+ 'Dcab: {0[Dcab]:d}'.format(table))
Jack: 4098; Sjoerd: 4127; Dcab: 8637678

This could also be done by passing the table as keyword arguments with the '**'
Loading...