mirror of https://github.com/python/cpython
gzip and bz2 are context managers
This commit is contained in:
parent
38f1bf6745
commit
6d83429a1d
|
@ -60,6 +60,11 @@ Handling of compressed files is offered by the :class:`BZ2File` class.
|
|||
reading. Instances support iteration in the same way as normal :class:`file`
|
||||
instances.
|
||||
|
||||
:class:`BZ2File` supports the :keyword:`with` statement.
|
||||
|
||||
.. versionchanged:: 2.7
|
||||
Support for the :keyword:`with` statement was added.
|
||||
|
||||
|
||||
.. method:: close()
|
||||
|
||||
|
|
|
@ -67,6 +67,11 @@ The module defines the following items:
|
|||
writing as *fileobj*, and retrieve the resulting memory buffer using the
|
||||
:class:`StringIO` object's :meth:`getvalue` method.
|
||||
|
||||
:class:`GzipFile` supports the :keyword:`with` statement.
|
||||
|
||||
.. versionchanged:: 2.7
|
||||
Support for the :keyword:`with` statement was added.
|
||||
|
||||
|
||||
.. function:: open(filename[, mode[, compresslevel]])
|
||||
|
||||
|
|
Loading…
Reference in New Issue