diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py index 6e6211de6b1684..63781301b94696 100644 --- a/Lib/zipfile/__init__.py +++ b/Lib/zipfile/__init__.py @@ -1518,7 +1518,9 @@ def comment(self, comment): self._didModify = True def read(self, name, pwd=None): - """Return file bytes for name.""" + """Return file bytes for name. 'pwd' is the password to decrypt + encrypted files. + """ with self.open(name, "r", pwd) as fp: return fp.read() @@ -1665,7 +1667,8 @@ def extract(self, member, path=None, pwd=None): """Extract a member from the archive to the current working directory, using its full name. Its file information is extracted as accurately as possible. `member' may be a filename or a ZipInfo object. You can - specify a different directory using `path'. + specify a different directory using `path'. You can specify the + password to decrypt the file using 'pwd'. """ if path is None: path = os.getcwd() @@ -1678,7 +1681,8 @@ def extractall(self, path=None, members=None, pwd=None): """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 namelist(). + by namelist(). You can specify the password to decrypt all files + using 'pwd'. """ if members is None: members = self.namelist() diff --git a/Misc/NEWS.d/next/Documentation/2023-02-23-23-42-43.gh-issue-102194.bTlEeI.rst b/Misc/NEWS.d/next/Documentation/2023-02-23-23-42-43.gh-issue-102194.bTlEeI.rst new file mode 100644 index 00000000000000..da11d963ddc18d --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2023-02-23-23-42-43.gh-issue-102194.bTlEeI.rst @@ -0,0 +1 @@ +Add additional pwd docstrings to ``Lib/zipfile/__init__.py``.