【发布时间】:2021-12-30 14:10:36
【问题描述】:
我正在尝试读取/提取文件train.gz的内容
我的代码:
import gzip
with gzip.open('train.gz', 'rb') as f:
file_content = f.read()
当我跑步时:
print(file_content)
我收到此错误(在 jupyter 笔记本上):
---------------------------------------------------------------------------
MemoryError Traceback (most recent call last)
/tmp/ipykernel_2392/4036593255.py in <module>
----> 1 print(file_content)
MemoryError:
有什么建议吗?
【问题讨论】:
标签: python python-3.x jupyter-notebook gzip