1

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

  • You can find an answer using zipfile in [this post](https://stackoverflow.com/questions/513788/delete-file-from-zipfile-with-the-zipfile-module). – JANO Jan 02 '22 at 21:48

1 Answers1

-2

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.

blackbishop
  • 30,945
  • 11
  • 55
  • 76