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.
1 parent a60c2fe commit ce77ee9Copy full SHA for ce77ee9
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