使用Python解压文件时的性能问题

2024-04-20 06:54:57 发布

您现在位置:Python中文网/ 问答频道 /正文

我使用以下代码解压缩受密码保护的压缩文件:

with zipfile.ZipFile(folder_name+'\\'+each+'\\'+latest, "r") as z:
        z.extractall(folder_name+'\\'+each+'\\'+each,pwd=passwd)

这在功能上是完美的,但速度非常慢。有没有什么方法可以让拉链拉得更快?在


Tags: 代码name功能aswithpwdfolderlatest
1条回答
网友
1楼 · 发布于 2024-04-20 06:54:57

从Python zipfile文档:

It supports decryption of encrypted files in ZIP archives, but it currently cannot create an encrypted file. Decryption is extremely slow as it is implemented in native Python rather than C.

为了加快受密码保护的解压速度,你可能应该使用一个单独的实用程序。

相关问题 更多 >