python 压缩/解压- gzip

代码示例

import gzip

#压缩
s_in = "我是中国人".encode("utf-8")
s_out = gzip.compress(s_in)
print([i for i in s_out])

#解压缩
res = gzip.decompress(s_out)
print(res)
print(res.decode("utf-8"))

你可能感兴趣的:(爬虫,python,python)