首页 > 编程知识 正文

python解压rar,python批量解压文件

时间:2023-05-03 22:58:32 阅读:110285 作者:2674

importos,pyzipper,py7zr

公式报表文件

defx(: )一次解压、提取、删除

foriinos.listdir(Path ) :

if'.zip'ini:

route=OS.path.join(path,I ) ) ) ) ) ) )。

withpyzipper.AESzipfile(route,' r ' ) asf:

f .提取全部(path ) )。

OS.remove(route ) )。

elif'.rar'ini:

OS.chdir(Path ) )。

route=OS.path.join(path,I ) ) ) ) ) ) )。

rar=rarfile.rarfile(I ) )

rar.extractall(path ) )。

是OS.remove(I )

elif'.7z'ini:

OS.chdir(Path ) )。

是OS.remove(I )

x () )。

defunpack(:#循环解冻

while1:

x () )。

zips=[]

forjinos.listdir(Path ) :

IFJ.endswith () (.zip ),).rar ) ) :

ZIPS.append(j ) )。

ifnotzips:

布莱克

unpack () ) )

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。