How can unrar a file with python

人走茶凉 提交于 2019-11-28 01:07:24
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.

A good package for it is rarfile :

Infos and docs here :

https://pypi.python.org/pypi/rarfile/

https://rarfile.readthedocs.org/en/latest/api.html

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!