Andrew Svetlov  committed fed7306

Drop double newlines printed in some file iteration examples.

Patch by Steven Kryskalla.

  • Participants
  • Parent commits cac64fb
  • Branches 3.2

Comments (0)

Files changed (2)

File Doc/tutorial/errors.rst

 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.
    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,
 Hannu Krosing
 Andrej Krpic
 Ivan Krstić
+Steven Kryskalla
 Andrew Kuchling
 Dave Kuhlman
 Vladimir Kushnir