summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-08-05 09:04:16 (GMT)
committerGeorg Brandl <georg@python.org>2008-08-05 09:04:16 (GMT)
commit11e18b0c2e0996632904a7dc7c953b2d6ae61b3a (patch)
tree4c53c1cda6b6b4256fb0255032fb1d1a382ba8a4 /Doc
parent694f1f8c27f639e385644eaea7a1d187252f9fe1 (diff)
downloadcpython-11e18b0c2e0996632904a7dc7c953b2d6ae61b3a.zip
cpython-11e18b0c2e0996632904a7dc7c953b2d6ae61b3a.tar.gz
cpython-11e18b0c2e0996632904a7dc7c953b2d6ae61b3a.tar.bz2
#3503: fix print statements in 3k doc.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/tutorial/controlflow.rst2
-rw-r--r--Doc/tutorial/inputoutput.rst2
-rw-r--r--Doc/tutorial/introduction.rst10
-rw-r--r--Doc/tutorial/modules.rst1
4 files changed, 6 insertions, 9 deletions
diff --git a/Doc/tutorial/controlflow.rst b/Doc/tutorial/controlflow.rst
index c21e531..488ba91 100644
--- a/Doc/tutorial/controlflow.rst
+++ b/Doc/tutorial/controlflow.rst
@@ -434,7 +434,7 @@ function like this::
def cheeseshop(kind, *arguments, **keywords):
print("-- Do you have any", kind, '?')
print("-- I'm sorry, we're all out of", kind)
- for arg in arguments: print arg
+ for arg in arguments: print(arg)
print('-'*40)
keys = sorted(keywords.keys())
for kw in keys: print(kw, ':', keywords[kw])
diff --git a/Doc/tutorial/inputoutput.rst b/Doc/tutorial/inputoutput.rst
index bf1c79f..5f8d04e 100644
--- a/Doc/tutorial/inputoutput.rst
+++ b/Doc/tutorial/inputoutput.rst
@@ -208,7 +208,7 @@ to the right argument, and returns the string resulting from this formatting
operation. For example::
>>> import math
- >>> print 'The value of PI is approximately %5.3f.' % math.pi
+ >>> print('The value of PI is approximately %5.3f.' % math.pi)
The value of PI is approximately 3.142.
Since :meth:`str.format` is quite new, a lot of Python code still uses the ``%``
diff --git a/Doc/tutorial/introduction.rst b/Doc/tutorial/introduction.rst
index 66c5a7c..bc81d7a 100644
--- a/Doc/tutorial/introduction.rst
+++ b/Doc/tutorial/introduction.rst
@@ -599,16 +599,12 @@ This example introduces several new features.
>>> print('The value of i is', i)
The value of i is 65536
- The keyword end can be used to avoid the newline after the output::
+ The keyword *end* can be used to avoid the newline after the output, or end
+ the output with a different string::
>>> a, b = 0, 1
>>> while b < 1000:
- ... print(b, ' ', end='')
+ ... print(b, end=' ')
... a, b = b, a+b
...
- >>> print()
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
-
- Note that nothing appeared after the loop ended, until we printed
- a newline.
-
diff --git a/Doc/tutorial/modules.rst b/Doc/tutorial/modules.rst
index 68e0258..1b3cbc5 100644
--- a/Doc/tutorial/modules.rst
+++ b/Doc/tutorial/modules.rst
@@ -32,6 +32,7 @@ called :file:`fibo.py` in the current directory with the following contents::
while b < n:
print(b, end=' ')
a, b = b, a+b
+ print()
def fib2(n): # return Fibonacci series up to n
result = []