【发布时间】:2021-06-21 06:20:33
【问题描述】:
我已经尝试了下面的代码,但它不起作用
import json
with open("/Users/elton/20210228test2.ndjson") as f:
test2data = ndjson.load(f)
【问题讨论】:
标签: python import jupyter-notebook libraries ndjson
我已经尝试了下面的代码,但它不起作用
import json
with open("/Users/elton/20210228test2.ndjson") as f:
test2data = ndjson.load(f)
【问题讨论】:
标签: python import jupyter-notebook libraries ndjson
这对我有用。 import ndjson 而不是 import json。在此处查看更多信息:https://pypi.org/project/ndjson/
import ndjson
# load from file-like objects
with open('data.ndjson') as f:
data = ndjson.load(f)
【讨论】: