I can to unzip a file if file is a .zip
and unrar file if my file type is .rar
.
How i can do this work with python 2.7?
Irakli Darbuashvili
Try the pyunpack
package:
from pyunpack import Archive
Archive('a.zip').extractall('/path/to')
lelouch
Late, but I wasn't satisfied with any of the answers.
pip install patool
import patoolib
patoolib.extract_archive("foo_bar.rar", outdir="path here")
Works on Windows and linux without any other libraries needed.
来源:https://stackoverflow.com/questions/17614467/how-can-unrar-a-file-with-python