Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit139d9ca

Browse files
Document that zipfile's pwd parameter is a bytes object
1 parent0e081a0 commit139d9ca

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎Doc/library/zipfile.rst

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,8 @@ ZipFile Objects
273273
Access a member of the archive as a binary file-like object. *name*
274274
can be either the name of a file within the archive or a:class:`ZipInfo`
275275
object. The *mode* parameter, if included, must be ``'r'`` (the default)
276-
or ``'w'``. *pwd* is the password used to decrypt encrypted ZIP files.
276+
or ``'w'``. *pwd* is the password used to decrypt encrypted ZIP files as a
277+
:class:`bytes` object.
277278

278279
:meth:`~ZipFile.open` is also a context manager and therefore supports the
279280
:keyword:`with` statement::
@@ -325,7 +326,7 @@ ZipFile Objects
325326
must be its full name or a:class:`ZipInfo` object. Its file information is
326327
extracted as accurately as possible. *path* specifies a different directory
327328
to extract to. *member* can be a filename or a:class:`ZipInfo` object.
328-
*pwd* is the password used for encrypted files.
329+
*pwd* is the password used for encrypted files as a:class:`bytes`.
329330

330331
Returns the normalized path created (a directory or new file).
331332

@@ -352,7 +353,7 @@ ZipFile Objects
352353
Extract all members from the archive to the current working directory. *path*
353354
specifies a different directory to extract to. *members* is optional and must
354355
be a subset of the list returned by:meth:`namelist`. *pwd* is the password
355-
used for encrypted files.
356+
used for encrypted files as a:class:`bytes` object.
356357

357358
..warning::
358359

@@ -377,16 +378,16 @@ ZipFile Objects
377378

378379
..method::ZipFile.setpassword(pwd)
379380

380-
Set *pwd* as default password to extract encrypted files.
381+
Set *pwd*(a:class:`bytes` object)as default password to extract encrypted files.
381382

382383

383384
..method::ZipFile.read(name, pwd=None)
384385

385386
Return the bytes of the file *name* in the archive. *name* is the name of the
386387
file in the archive, or a:class:`ZipInfo` object. The archive must be open for
387-
read or append. *pwd* is the password used for encryptedfilesand, if specified,
388-
it will overridethe default password set with:meth:`setpassword`. Calling
389-
:meth:`read` on a ZipFile that uses a compression method other than
388+
read or append. *pwd* is the password used for encrypted filesas a:class:`bytes`
389+
object and, if specified, overridesthe default password set with:meth:`setpassword`.
390+
Calling:meth:`read` on a ZipFile that uses a compression method other than
390391
:const:`ZIP_STORED`,:const:`ZIP_DEFLATED`,:const:`ZIP_BZIP2` or
391392
:const:`ZIP_LZMA` will raise a:exc:`NotImplementedError`. An error will also
392393
be raised if the corresponding compression module is not available.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp