summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-01-07 18:47:44 (GMT)
committerGeorg Brandl <georg@python.org>2008-01-07 18:47:44 (GMT)
commit62416bcf5ad46019f758aa212b05b3d60cb71ef3 (patch)
tree168c2f432e63ebc9265a93e41274c5ca53513a48 /Doc
parent76b30d1688a7ba1ff1b01a3eb21bf4890f71d404 (diff)
downloadcpython-62416bcf5ad46019f758aa212b05b3d60cb71ef3.zip
cpython-62416bcf5ad46019f758aa212b05b3d60cb71ef3.tar.gz
cpython-62416bcf5ad46019f758aa212b05b3d60cb71ef3.tar.bz2
#467924, patch by Alan McIntyre: Add ZipFile.extract and ZipFile.extractall.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/zipfile.rst28
1 files changed, 28 insertions, 0 deletions
diff --git a/Doc/library/zipfile.rst b/Doc/library/zipfile.rst
index e904a37..f1cfc1b 100644
--- a/Doc/library/zipfile.rst
+++ b/Doc/library/zipfile.rst
@@ -180,6 +180,27 @@ ZipFile Objects
.. versionadded:: 2.6
+.. method:: ZipFile.extract(member[, path[, pwd]])
+
+ Extract a member from the archive to the current working directory, using its
+ full name. Its file information is extracted as accurately as possible.
+ *path* specifies a different directory to extract to. *member* can be a
+ filename or a :class:`ZipInfo` object. *pwd* is the password used for
+ encrypted files.
+
+ .. versionadded:: 2.6
+
+
+.. method:: ZipFile.extractall([path[, members[, pwd]]])
+
+ Extract all members from the archive to the current working directory. *path*
+ specifies a different directory to extract to. *members* is optional and must
+ be a subset of the list returned by :meth:`namelist`. *pwd* is the password
+ used for encrypted files.
+
+ .. versionadded:: 2.6
+
+
.. method:: ZipFile.printdir()
Print a table of contents for the archive to ``sys.stdout``.
@@ -249,6 +270,13 @@ ZipFile Objects
created with mode ``'r'`` will raise a :exc:`RuntimeError`. Calling
:meth:`writestr` on a closed ZipFile will raise a :exc:`RuntimeError`.
+ .. note::
+
+ When passing a :class:`ZipInfo` instance as the *zinfo_or_acrname* parameter,
+ the compression method used will be that specified in the *compress_type*
+ member of the given :class:`ZipInfo` instance. By default, the
+ :class:`ZipInfo` constructor sets this member to :const:`ZIP_STORED`.
+
The following data attribute is also available: