[Python-3000-checkins] r65252 - python/branches/py3k/Doc/tutorial/inputoutput.rst

benjamin.peterson python-3000-checkins at python.org
Sat Jul 26 23:59:03 CEST 2008

Author: benjamin.peterson
Date: Sat Jul 26 23:59:03 2008
New Revision: 65252

fix print syntax in tutorial


Modified: python/branches/py3k/Doc/tutorial/inputoutput.rst
--- python/branches/py3k/Doc/tutorial/inputoutput.rst	(original)
+++ python/branches/py3k/Doc/tutorial/inputoutput.rst	Sat Jul 26 23:59:03 2008
@@ -131,27 +131,27 @@
 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

More information about the Python-3000-checkins mailing list