mirror of
https://github.com/django/django.git
synced 2025-07-25 22:24:16 +00:00
Fixed #20604 - Fixed file example in docs.
Thanks Chris Lasher for the report.
This commit is contained in:
parent
2a6a32047d
commit
a1122e14a6
1 changed files with 3 additions and 3 deletions
|
@ -87,9 +87,9 @@ The following approach may be used to close files automatically::
|
||||||
|
|
||||||
# Create a Python file object using open() and the with statement
|
# Create a Python file object using open() and the with statement
|
||||||
>>> with open('/tmp/hello.world', 'w') as f:
|
>>> with open('/tmp/hello.world', 'w') as f:
|
||||||
>>> myfile = File(f)
|
... myfile = File(f)
|
||||||
>>> for line in myfile:
|
... myfile.write('Hello World')
|
||||||
>>> print line
|
...
|
||||||
>>> myfile.closed
|
>>> myfile.closed
|
||||||
True
|
True
|
||||||
>>> f.closed
|
>>> f.closed
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue