Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
406221cc
Commit
406221cc
authored
Mar 13, 2015
by
Berker Peksag
Browse files
Options
Browse Files
Download
Plain Diff
Issue #22154: Add an example to show context management protocol support of ZipFile.open().
Patch by Mike Short.
parents
c2ccce79
ce77ee91
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
Doc/library/zipfile.rst
Doc/library/zipfile.rst
+7
-0
No files found.
Doc/library/zipfile.rst
View file @
406221cc
...
...
@@ -210,6 +210,13 @@ ZipFile Objects
password
used
for
encrypted
files
.
Calling
:
meth
:`.
open
`
on
a
closed
ZipFile
will
raise
a
:
exc
:`
RuntimeError
`.
:
func
:`~
ZipFile
.
open
`
is
also
a
context
manager
and
therefore
supports
the
:
keyword
:`
with
`
statement
::
with
ZipFile
(
'spam.zip'
)
as
myzip
:
with
myzip
.
open
(
'eggs.txt'
)
as
myfile
:
print
(
myfile
.
read
())
..
note
::
The
file
-
like
object
is
read
-
only
and
provides
the
following
methods
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment