200字范文,内容丰富有趣,生活中的好帮手!
200字范文 > Python unrar解压rar压缩文件

Python unrar解压rar压缩文件

时间:2020-08-30 16:00:26

相关推荐

Python unrar解压rar压缩文件

安装

$ pip install unrar

解压

from unrar import rarfile# 源码:/matiasb/python-unrar# 下载UnRAR.dll /rar_add.htm# 配置UnRAR.dll位置# 在系统变量里配置# UNRAR_LIB_PATH = C:\Program Files (x86)\UnrarDLL\x64\UnRAR64.dllfilename = 'rar压缩包路径'extract_path = '解压路径'fp = rarfile.RarFile(filename)for pwd in range(0, 10000):# 左对齐,不足补0pwd = "{0:0>4}".format(pwd)try:fp.extractall(pwd=pwd, path=extract_path)print('Success:', pwd)breakexcept Exception:print(pwd)pass

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。