Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c2ccce7 + ce77ee9 commit 406221cCopy full SHA for 406221c
1 file changed
Doc/library/zipfile.rst
@@ -210,6 +210,13 @@ ZipFile Objects
210
password used for encrypted files. Calling :meth:`.open` on a closed
211
ZipFile will raise a :exc:`RuntimeError`.
212
213
+ :func:`~ZipFile.open` is also a context manager and therefore supports the
214
+ :keyword:`with` statement::
215
+
216
+ with ZipFile('spam.zip') as myzip:
217
+ with myzip.open('eggs.txt') as myfile:
218
+ print(myfile.read())
219
220
.. note::
221
222
The file-like object is read-only and provides the following methods:
0 commit comments