gzip
2018-03-20 本文已影响0人
xncode
gzip.GzipFile([filename[, mode[, compresslevel[, fileobj[, mtime]]]]])
必须给出filename或fileobj
gzip.open(filename[, mode[, compresslevel]])
例子
import gzip
with gzip.open('file.txt.gz', 'rb') as f:
file_content = f.read()
import gzip
content = "Lots of content here"
with gzip.open('file.txt.gz', 'wb') as f:
f.write(content)