summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/zipfile.rst24
1 files changed, 22 insertions, 2 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index a0de10c..4cde1dd 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -132,8 +132,9 @@ ZipFile Objects
.. class:: ZipFile(file, mode='r', compression=ZIP_STORED, allowZip64=True)
- Open a ZIP file, where *file* can be either a path to a file (a string) or a
- file-like object. The *mode* parameter should be ``'r'`` to read an existing
+ Open a ZIP file, where *file* can be a path to a file (a string), a
+ file-like object or a :term:`path-like object`.
+ The *mode* parameter should be ``'r'`` to read an existing
file, ``'w'`` to truncate and write a new file, ``'a'`` to append to an
existing file, or ``'x'`` to exclusively create and write a new file.
If *mode* is ``'x'`` and *file* refers to an existing file,
@@ -183,6 +184,9 @@ ZipFile Objects
Previously, a plain :exc:`RuntimeError` was raised for unrecognized
compression values.
+ .. versionchanged:: 3.6.2
+ The *file* parameter accepts a :term:`path-like object`.
+
.. method:: ZipFile.close()
@@ -284,6 +288,9 @@ ZipFile Objects
Calling :meth:`extract` on a closed ZipFile will raise a
:exc:`ValueError`. Previously, a :exc:`RuntimeError` was raised.
+ .. versionchanged:: 3.6.2
+ The *path* parameter accepts a :term:`path-like object`.
+
.. method:: ZipFile.extractall(path=None, members=None, pwd=None)
@@ -304,6 +311,9 @@ ZipFile Objects
Calling :meth:`extractall` on a closed ZipFile will raise a
:exc:`ValueError`. Previously, a :exc:`RuntimeError` was raised.
+ .. versionchanged:: 3.6.2
+ The *path* parameter accepts a :term:`path-like object`.
+
.. method:: ZipFile.printdir()
@@ -403,6 +413,9 @@ ZipFile Objects
The following data attributes are also available:
+.. attribute:: ZipFile.filename
+
+ Name of the ZIP file.
.. attribute:: ZipFile.debug
@@ -488,6 +501,9 @@ The :class:`PyZipFile` constructor takes the same parameters as the
.. versionadded:: 3.4
The *filterfunc* parameter.
+ .. versionchanged:: 3.6.2
+ The *pathname* parameter accepts a :term:`path-like object`.
+
.. _zipinfo-objects:
@@ -514,6 +530,10 @@ file:
.. versionadded:: 3.6
+ .. versionchanged:: 3.6.2
+ The *filename* parameter accepts a :term:`path-like object`.
+
+
Instances have the following methods and attributes:
.. method:: ZipInfo.is_dir()