Suppose I have a file like this:
MyFile.zip
In Python, what is a neat way to convert the .zip
file into a gzip file? e.g. final output MyFile.gz
, a valid gzipped file.
Suppose I have a file like this:
MyFile.zip
In Python, what is a neat way to convert the .zip
file into a gzip file? e.g. final output MyFile.gz
, a valid gzipped file.
There's a gzip module for this sort of conversion, I am going off the python docs for this, link here.
Basically what you're looking for is an input i.e. your current file/path/to/zip/file
and then taking that as input to the gzip conversion by using shutil.copyfileobj(src, dest)
. This is kinda like layman terms for how to do it but all the details are in the link.