简体   繁体   English

如何在python中重命名压缩文件的内容?

[英]How I can rename the contents of compressed file befor extract in python?

有没有办法重命名压缩文件中的文件名,但没有提取它,在python?

No. The python ZipFile module does not provide any way to do that. 不,python ZipFile模块没有提供任何方法。 You can extract the archive into memory, and then rewrite it with the new filename for the file in question, but that is memory intensive and not what you want to do. 您可以将存档提取到内存中,然后使用相关文件的新文件名重写它,但这是内存密集型而不是您想要执行的操作。 You may be able to edit the zipfile's header and information fields, but the standard Python interface doesn't have an easy way to do so. 您可以编辑zipfile的标题和信息字段,但标准的Python界面没有简单的方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM