简体   繁体   中英

Python - Delete files in a zip archive

I would like to know how to delete a file in a zip archive with python and if it is possible to do it with the os module or with the zipfile module

Sorry, but I can't comment. How about extracting, deleting and re-archiving? Whichever process you try, to delete a file in a zip, the whole zip has to be extracted.

You can mount a zip on Windows or Linux , and use python to delete a file in the zip the same way as you delete a normal file. Even if that doesn't look like, in this process too, the zip file will be rebuilt.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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