summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Graham <timograham@gmail.com>2013-06-14 21:28:17 -0400
committerTim Graham <timograham@gmail.com>2013-06-14 21:29:20 -0400
commite411e9931272cd22247095fc2af8d26d58eeddd6 (patch)
treeceb887e5902f143e1529b70bada34d99732a4dc1
parente65f0c255940f9f4ae5e3429e59f3d314104e1fc (diff)
[1.5.x] Fixed #20604 - Fixed file example in docs.
Thanks Chris Lasher for the report. Backport of a1122e14a6 from master
-rw-r--r--docs/topics/files.txt6
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/topics/files.txt b/docs/topics/files.txt
index fb3cdd4af9..96e0557cc4 100644
--- a/docs/topics/files.txt
+++ b/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