PyDocs

Nav

File and Directory Access

unpack_archive

shutil

function (source)
  • unpack_archive(filename[, extract_dir[, format[, filter]]])
Unpack an archive.

`filename` is the name of the archive.

`extract_dir` is the name of the target directory, where the archive
is unpacked. If not provided, the current working directory is used.

`format` is the archive format: one of "zip", "tar", "gztar", "bztar",
"xztar", or "zstdtar".  Or any other registered format.  If not provided,
unpack_archive will use the filename extension and see if an unpacker
was registered for that extension.

In case none is found, a ValueError is raised.

If `filter` is given, it is passed to the underlying
extraction function.
Changed in 3.7, 3.12
  • 3.7: Accepts a path-like object for filename and extract_dir.
  • 3.12: Added the filter argument.
0 Examples
No examples for shutil/unpack_archive.
See Also
No see-alsos for shutil/unpack_archive
0 Notes
No notes for unpack_archive