如何使用python zipfile在此代码中插入进度条?

How can I insert a progress bar in this code with python zipfile?

提问人:jhown 提问时间:12/30/2022 最后编辑:jhown 更新时间:1/3/2023 访问量:57

问:

我试图用 zipfile 模块为这段代码提供进度条:

object = zipfile.ZipFile(name, 'w', zipfile.ZIP_LZMA)
object.write(f'{self.dir}\\{new_archive}')
os.remove(f"{self.dir}\\{new_archive}")

我该怎么做? PS:此函数在其他线程中运行

我尝试使用TQDM,但没有成功。

编辑:如何在压缩时测量zipfile模块的等待时间?

多线程 进度条 python-asyncio python-zipfile

评论

0赞 itprorh66 12/31/2022
请编辑问题,将其限制在特定问题上,并具有足够的细节以确定适当的答案。
0赞 Aiq0 1/3/2023
使用 Python 提取 ZipFile 类似,显示进度百分比?
0赞 jhown 1/3/2023
不,我需要压缩而不是提取,提取已经具有“预定义”大小

答: 暂无答案