Hi everyone,
I'm looking for Pytonic readable way to compress files.
I've found https://docs.python.org/3/library/gzip.html
with which I came out with
Any ideas how to keep or set the filename ?
Or any other method to compress and save ?
Thanks.
I'm looking for Pytonic readable way to compress files.
I've found https://docs.python.org/3/library/gzip.html
with which I came out with
import gzip
with open('/somewhere/aFile.whatever', 'rb') as ToBeCompressed:
ReadedBytes = ToBeCompressed.read()
with gzip.open('/somewhere/destination.gz', 'wb') as f:
f.write(ReadedBytes )so it work, but within the gz , the file lost it's filename is became 'destination/destination'Any ideas how to keep or set the filename ?
Or any other method to compress and save ?
Thanks.
