From 0cea15736260ca4a43c666c0fec3faaa47e67346 Mon Sep 17 00:00:00 2001 From: Benjamin Peterson Date: Sat, 26 Jul 2008 21:59:03 +0000 Subject: fix print syntax in tutorial --- Doc/tutorial/inputoutput.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Doc/tutorial') diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst index cbca95b77f..af074dd37b 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 -- cgit v1.2.1