【发布时间】:2017-09-18 15:23:55
【问题描述】:
根据https://docs.python.org/3/library/gzip.html 创建压缩的gzip 文件需要以下内容:
import gzip
content = b"Lots of content here"
with gzip.open('/home/joe/file.txt.gz', 'wb') as f:
f.write(content)
但是,当我运行代码时,我使用 python 3 AttributeError: module 'gzip' has no attribute 'open' 得到以下错误
不知道发生了什么......
【问题讨论】:
标签: python-3.x gzip