【发布时间】:2017-10-17 18:01:46
【问题描述】:
为了打开 .zip 文件而不是 .gz,我必须在此代码中进行哪些更改?
import gzip
embeddingsIn = gzip.open(embeddingsPath, "r") if embeddingsPath.endswith('.gz') else open(embeddingsPath, encoding="utf8")
【问题讨论】:
-
到目前为止你尝试过什么?您已使用
zipfile标签标记了这个问题,这恰好是您将使用的 Python 模块的名称。也许阅读该模块的文档? -
对不起,我已经删除了那个标签,实际上我是 python 新手,所以我对语法一无所知..
-
好吧,开始here。