]> granicus.if.org Git - python/commitdiff
Drop double newlines printed in some file iteration examples.
authorAndrew Svetlov <andrew.svetlov@gmail.com>
Sat, 8 Dec 2012 15:59:03 +0000 (17:59 +0200)
committerAndrew Svetlov <andrew.svetlov@gmail.com>
Sat, 8 Dec 2012 15:59:03 +0000 (17:59 +0200)
Patch by Steven Kryskalla.

Doc/tutorial/errors.rst
Misc/ACKS

index 53be499f00e13a6e66e06978a022967c80d297fb..2b76c32da0ff449a36630e38d5a6770205d196ad 100644 (file)
@@ -387,7 +387,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, end="")
 
 The problem with this code is that it leaves the file open for an indeterminate
 amount of time after this part of the code has finished executing.
@@ -397,7 +397,7 @@ used in a way that ensures they are always cleaned up promptly and correctly. ::
 
    with open("myfile.txt") as f:
        for line in f:
-           print(line)
+           print(line, end="")
 
 After the statement is executed, the file *f* is always closed, even if a
 problem was encountered while processing the lines. Objects which, like files,
index 640287dc5340a235f55f1cb6655085195dcb8b3f..9e662f6a73175bf8264b02c038d75ec7a488108f 100644 (file)
--- a/Misc/ACKS
+++ b/Misc/ACKS
@@ -592,6 +592,7 @@ Cédric Krier
 Hannu Krosing
 Andrej Krpic
 Ivan Krstić
+Steven Kryskalla
 Andrew Kuchling
 Dave Kuhlman
 Vladimir Kushnir