【发布时间】:2018-06-28 23:29:39
【问题描述】:
我在 python3.6 中遇到了这个错误。
我的 json 文件如下所示:
{
"id":"776",
"text":"Scientists have just discovered a bizarre pattern in global weather. Extreme heat waves like the one that hit the Eastern US in 2012, leaving at least 82 dead, don't just come out of nowhere."
}
它的编码是“utf-8”,我在网上查了一下,它是一个有效的 json 文件。我尝试以这种方式加载它:
p = 'doc1.json'
json.loads(p)
我也试过了:
p = "doc1.json"
with open(p, "r") as f:
doc = json.load(f)
错误是一样的:
JSONDecodeError:预期值:第 1 行第 1 列(字符 0)
有人可以帮忙吗?谢谢!
【问题讨论】: