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

Skip to content

Commit 11e18b0

Browse files
committed
#3503: fix print statements in 3k doc.
1 parent 694f1f8 commit 11e18b0

4 files changed

Lines changed: 6 additions & 9 deletions

File tree

Doc/tutorial/controlflow.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ function like this::
434434
def cheeseshop(kind, *arguments, **keywords):
435435
print("-- Do you have any", kind, '?')
436436
print("-- I'm sorry, we're all out of", kind)
437-
for arg in arguments: print arg
437+
for arg in arguments: print(arg)
438438
print('-'*40)
439439
keys = sorted(keywords.keys())
440440
for kw in keys: print(kw, ':', keywords[kw])

Doc/tutorial/inputoutput.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ to the right argument, and returns the string resulting from this formatting
208208
operation. For example::
209209

210210
>>> import math
211-
>>> print 'The value of PI is approximately %5.3f.' % math.pi
211+
>>> print('The value of PI is approximately %5.3f.' % math.pi)
212212
The value of PI is approximately 3.142.
213213

214214
Since :meth:`str.format` is quite new, a lot of Python code still uses the ``%``

Doc/tutorial/introduction.rst

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -599,16 +599,12 @@ This example introduces several new features.
599599
>>> print('The value of i is', i)
600600
The value of i is 65536
601601

602-
The keyword end can be used to avoid the newline after the output::
602+
The keyword *end* can be used to avoid the newline after the output, or end
603+
the output with a different string::
603604

604605
>>> a, b = 0, 1
605606
>>> while b < 1000:
606-
... print(b, ' ', end='')
607+
... print(b, end=' ')
607608
... a, b = b, a+b
608609
...
609-
>>> print()
610610
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
611-
612-
Note that nothing appeared after the loop ended, until we printed
613-
a newline.
614-

Doc/tutorial/modules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ called :file:`fibo.py` in the current directory with the following contents::
3232
while b < n:
3333
print(b, end=' ')
3434
a, b = b, a+b
35+
print()
3536

3637
def fib2(n): # return Fibonacci series up to n
3738
result = []

0 commit comments

Comments
 (0)