diff Doc/tutorial/errors.rst @ 80758:29627bd5b333 2.7

Drop double newlines printed in some file iteration examples. Patch by Steven Kryskalla.
author Andrew Svetlov <andrew.svetlov@gmail.com>
date Sat, 08 Dec 2012 18:01:27 +0200
parents b873afe640e2
children
line wrap: on
line diff
--- a/Doc/tutorial/errors.rst	Sat Dec 08 12:29:40 2012 +0200
+++ b/Doc/tutorial/errors.rst	Sat Dec 08 18:01:27 2012 +0200
@@ -397,7 +397,7 @@
 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 @@
 
    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