How can I extract a .zip
or .rar
file using Python?
7zip is so easy to use that you can use it to extract RAR files without even opening the software. All you have to do is right-click the RAR file you want to open, hover over the 7zip menu, and click one of the “extract” options, depending on where you want to extract the files.
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.
Try the pyunpack
package:
from pyunpack import Archive Archive('a.zip').extractall('/path/to')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With