Skip to content

Commit b214ffc

Browse files
author
georg.brandl
committed
Shorten some overlong lines.
git-svn-id: http://svn.python.org/projects/python/trunk@65253 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent a81639c commit b214ffc

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Doc/tutorial/inputoutput.rst

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -143,12 +143,14 @@ the position of the object passed into the format method. ::
143143
If keyword arguments are used in the format method, their values are referred to
144144
by using the name of the argument. ::
145145

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

149150
Positional and keyword arguments can be arbitrarily combined::
150151

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

154156
An optional ``':``` and format specifier can follow the field name. This also
@@ -176,7 +178,8 @@ instead of by position. This can be done by simply passing the dict and using
176178
square brackets ``'[]'`` to access the keys ::
177179

178180
>>> table = {'Sjoerd': 4127, 'Jack': 4098, 'Dcab': 8637678}
179-
>>> print 'Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; Dcab: {0[Dcab]:d}'.format(table)
181+
>>> print ('Jack: {0[Jack]:d}; Sjoerd: {0[Sjoerd]:d}; '
182+
... 'Dcab: {0[Dcab]:d}'.format(table))
180183
Jack: 4098; Sjoerd: 4127; Dcab: 8637678
181184

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

0 commit comments

Comments
 (0)