Python supports zipping files when zlib is available, ZIP_DEFLATE
see: https://docs.python.org/3.4/library/zipfile.html
The zip
command-line program on Linux supports -1
fastest, -9
best.
Is there a way to set the compression level of a zip file created in Python's zipfile
module?
Starting from python 3.7, the zipfile
module added the compresslevel
parameter.
https://docs.python.org/3/library/zipfile.html
I know this question is dated, but for people like me, that fall in this question, it may be a better option than the accepted one.
The zipfile
module does not provide this. During compression it uses constant from zlib
- Z_DEFAULT_COMPRESSION
. By default it equals -1. So you can try to change this constant manually, as possible solution.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With