Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
82e17d28
Commit
82e17d28
authored
Aug 05, 2008
by
Georg Brandl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
#3503: fix print statements in 3k doc.
parent
49de78c3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
6 additions
and
9 deletions
+6
-9
Doc/tutorial/controlflow.rst
Doc/tutorial/controlflow.rst
+1
-1
Doc/tutorial/inputoutput.rst
Doc/tutorial/inputoutput.rst
+1
-1
Doc/tutorial/introduction.rst
Doc/tutorial/introduction.rst
+3
-7
Doc/tutorial/modules.rst
Doc/tutorial/modules.rst
+1
-0
No files found.
Doc/tutorial/controlflow.rst
View file @
82e17d28
...
@@ -434,7 +434,7 @@ function like this::
...
@@ -434,7 +434,7 @@ function like this::
def cheeseshop(kind, *arguments, **keywords):
def cheeseshop(kind, *arguments, **keywords):
print("-- Do you have any", kind, '?')
print("-- Do you have any", kind, '?')
print("-- I'm sorry, we're all out of", 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)
print('-'*40)
keys = sorted(keywords.keys())
keys = sorted(keywords.keys())
for kw in keys: print(kw, ':', keywords[kw])
for kw in keys: print(kw, ':', keywords[kw])
...
...
Doc/tutorial/inputoutput.rst
View file @
82e17d28
...
@@ -208,7 +208,7 @@ to the right argument, and returns the string resulting from this formatting
...
@@ -208,7 +208,7 @@ to the right argument, and returns the string resulting from this formatting
operation. For example::
operation. For example::
>>> import math
>>> 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.
The value of PI is approximately 3.142.
Since :meth:`str.format` is quite new, a lot of Python code still uses the ``%``
Since :meth:`str.format` is quite new, a lot of Python code still uses the ``%``
...
...
Doc/tutorial/introduction.rst
View file @
82e17d28
...
@@ -599,16 +599,12 @@ This example introduces several new features.
...
@@ -599,16 +599,12 @@ This example introduces several new features.
>>> print('The value of i is', i)
>>> print('The value of i is', i)
The value of i is 65536
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
>>> a, b = 0, 1
>>> while b < 1000:
>>> while b < 1000:
... print(b,
' ', end='
')
... print(b,
end='
')
... a, b = b, a+b
... a, b = b, a+b
...
...
>>> print()
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987
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.
Doc/tutorial/modules.rst
View file @
82e17d28
...
@@ -32,6 +32,7 @@ called :file:`fibo.py` in the current directory with the following contents::
...
@@ -32,6 +32,7 @@ called :file:`fibo.py` in the current directory with the following contents::
while
b
<
n
:
while
b
<
n
:
print
(
b
,
end
=
' '
)
print
(
b
,
end
=
' '
)
a
,
b
=
b
,
a
+
b
a
,
b
=
b
,
a
+
b
print
()
def
fib2
(
n
):
#
return
Fibonacci
series
up
to
n
def
fib2
(
n
):
#
return
Fibonacci
series
up
to
n
result
=
[]
result
=
[]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment