diff options
author | Benjamin Peterson <benjamin@python.org> | 2008-07-26 21:59:03 (GMT) |
---|---|---|
committer | Benjamin Peterson <benjamin@python.org> | 2008-07-26 21:59:03 (GMT) |
commit | 0cea15736260ca4a43c666c0fec3faaa47e67346 (patch) | |
tree | b6e0cae320833aa6c4b4d69760494f22a4a01ec4 /Doc/tutorial | |
parent | 13856ea25750a357716ca07bd4d258d758767866 (diff) | |
download | cpython-0cea15736260ca4a43c666c0fec3faaa47e67346.zip cpython-0cea15736260ca4a43c666c0fec3faaa47e67346.tar.gz cpython-0cea15736260ca4a43c666c0fec3faaa47e67346.tar.bz2 |
fix print syntax in tutorial
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/inputoutput.rst | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst index cbca95b..af074dd 100644 --- a/Doc/tutorial/inputoutput.rst +++ b/Doc/tutorial/inputoutput.rst @@ -131,27 +131,27 @@ with zeros. It understands about plus and minus signs:: Basic usage of the :meth:`str.format` method looks like this:: - >>> print 'We are the {0} who say "{1}!"'.format('knights', 'Ni') + >>> print('We are the {0} who say "{1}!"'.format('knights', 'Ni')) We are the knights who say "Ni!" The brackets and characters within them (called format fields) are replaced with the objects passed into the format method. The number in the brackets refers to the position of the object passed into the format method. :: - >>> print '{0} and {1}'.format('spam', 'eggs') + >>> print('{0} and {1}'.format('spam', 'eggs')) spam and eggs - >>> print '{1} and {0}'.format('spam', 'eggs') + >>> print('{1} and {0}'.format('spam', 'eggs')) eggs and spam 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 |