Different name of unpacked tar.gz folder using tarfile.extractall()
问题 I am using pythons tarfile.extractall() to unpack a foo.tar.gz file. I want to access the extracted folder, but sometimes the extracted folder has a different name than the packed file. I need a way to control the name of the extracted folder or, a return value that tells me the name of the extracted folder. Example packed file: foo-rc-2.0.0.tar.gz unpacked folder: foo-2.0.0-rc 回答1: tarfile.extractall() simply extracts all the files in the tarball to the current directory, or a directory of