diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-08 16:01:27 (GMT) |
---|---|---|
committer | Andrew Svetlov <andrew.svetlov@gmail.com> | 2012-12-08 16:01:27 (GMT) |
commit | bd5279ea247e46d4bf88d1b1b306060e479e227f (patch) | |
tree | 86b3094d7567cae7abf996b449e512007deecfcc /Doc/tutorial | |
parent | b7bc92530e2a48e0760899b33efffbc9450e857a (diff) | |
download | cpython-bd5279ea247e46d4bf88d1b1b306060e479e227f.zip cpython-bd5279ea247e46d4bf88d1b1b306060e479e227f.tar.gz cpython-bd5279ea247e46d4bf88d1b1b306060e479e227f.tar.bz2 |
Drop double newlines printed in some file iteration examples.
Patch by Steven Kryskalla.
Diffstat (limited to 'Doc/tutorial')
-rw-r--r-- | Doc/tutorial/classes.rst | 2 | ||||
-rw-r--r-- | Doc/tutorial/errors.rst | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/Doc/tutorial/classes.rst b/Doc/tutorial/classes.rst index 95a3a83..2cc3610 100644 --- a/Doc/tutorial/classes.rst +++ b/Doc/tutorial/classes.rst @@ -688,7 +688,7 @@ using a :keyword:`for` statement:: for char in "123": print char for line in open("myfile.txt"): - print line + print line, This style of access is clear, concise, and convenient. The use of iterators pervades and unifies Python. Behind the scenes, the :keyword:`for` statement diff --git a/Doc/tutorial/errors.rst b/Doc/tutorial/errors.rst index 5fc1eeb..6d14cb3 100644 --- a/Doc/tutorial/errors.rst +++ b/Doc/tutorial/errors.rst @@ -397,7 +397,7 @@ succeeded or failed. Look at the following example, which tries to open a file and print its contents to the screen. :: for line in open("myfile.txt"): - print line + print line, The problem with this code is that it leaves the file open for an indeterminate amount of time after the code has finished executing. This is not an issue in @@ -407,7 +407,7 @@ ensures they are always cleaned up promptly and correctly. :: with open("myfile.txt") as f: for line in f: - print line + print line, After the statement is executed, the file *f* is always closed, even if a problem was encountered while processing the lines. Other objects which provide |