Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[1.5.x] Fixed #20604 - Fixed file example in docs.

Thanks Chris Lasher for the report.

Backport of a1122e1 from master
  • Loading branch information...
commit e411e9931272cd22247095fc2af8d26d58eeddd6 1 parent e65f0c2
@timgraham timgraham authored
Showing with 3 additions and 3 deletions.
  1. +3 −3 docs/topics/files.txt
View
6 docs/topics/files.txt
@@ -85,9 +85,9 @@ The following approach may be used to close files automatically::
# Create a Python file object using open() and the with statement
>>> with open('/tmp/hello.world', 'w') as f:
- >>> myfile = File(f)
- >>> for line in myfile:
- >>> print line
+ ... myfile = File(f)
+ ... myfile.write('Hello World')
+ ...
>>> myfile.closed
True
>>> f.closed
Please sign in to comment.
Something went wrong with that request. Please try again.