Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0cea157

Browse files
committed
fix print syntax in tutorial
1 parent 13856ea commit 0cea157

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

Doc/tutorial/inputoutput.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -131,27 +131,27 @@ with zeros. It understands about plus and minus signs::
131131

132132
Basic usage of the :meth:`str.format` method looks like this::
133133

134-
>>> print 'We are the {0} who say "{1}!"'.format('knights', 'Ni')
134+
>>> print('We are the {0} who say "{1}!"'.format('knights', 'Ni'))
135135
We are the knights who say "Ni!"
136136

137137
The brackets and characters within them (called format fields) are replaced with
138138
the objects passed into the format method. The number in the brackets refers to
139139
the position of the object passed into the format method. ::
140140

141-
>>> print '{0} and {1}'.format('spam', 'eggs')
141+
>>> print('{0} and {1}'.format('spam', 'eggs'))
142142
spam and eggs
143-
>>> print '{1} and {0}'.format('spam', 'eggs')
143+
>>> print('{1} and {0}'.format('spam', 'eggs'))
144144
eggs and spam
145145

146146
If keyword arguments are used in the format method, their values are referred to
147147
by using the name of the argument. ::
148148

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

152152
Positional and keyword arguments can be arbitrarily combined::
153153

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

157157
An optional ``':``` and format specifier can follow the field name. This also

0 commit comments

Comments
 (0)