@@ -273,7 +273,8 @@ ZipFile Objects
273
273
Access a member of the archive as a binary file-like object. *name *
274
274
can be either the name of a file within the archive or a :class: `ZipInfo `
275
275
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.
277
278
278
279
:meth: `~ZipFile.open ` is also a context manager and therefore supports the
279
280
:keyword: `with ` statement::
@@ -325,7 +326,7 @@ ZipFile Objects
325
326
must be its full name or a :class: `ZipInfo ` object. Its file information is
326
327
extracted as accurately as possible. *path * specifies a different directory
327
328
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 ` .
329
330
330
331
Returns the normalized path created (a directory or new file).
331
332
@@ -352,7 +353,7 @@ ZipFile Objects
352
353
Extract all members from the archive to the current working directory. *path *
353
354
specifies a different directory to extract to. *members * is optional and must
354
355
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 .
356
357
357
358
.. warning ::
358
359
@@ -377,16 +378,16 @@ ZipFile Objects
377
378
378
379
.. method :: ZipFile.setpassword(pwd)
379
380
380
- Set *pwd * as default password to extract encrypted files.
381
+ Set *pwd * (a :class: ` bytes ` object) as default password to extract encrypted files.
381
382
382
383
383
384
.. method :: ZipFile.read(name, pwd=None)
384
385
385
386
Return the bytes of the file *name * in the archive. *name * is the name of the
386
387
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 encrypted files and, if specified,
388
- it will override the 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 files as a :class: ` bytes `
389
+ object and, if specified, overrides the default password set with :meth: `setpassword `.
390
+ Calling :meth: `read ` on a ZipFile that uses a compression method other than
390
391
:const: `ZIP_STORED `, :const: `ZIP_DEFLATED `, :const: `ZIP_BZIP2 ` or
391
392
:const: `ZIP_LZMA ` will raise a :exc: `NotImplementedError `. An error will also
392
393
be raised if the corresponding compression module is not available.
0 commit comments