![](/img/trans.png)
[英]json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0) python
[英]Why does the python JSON module show the error : json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)
我的 JSON 模块有问题。 我不知道为什么这是一个错误:
with open('Book Store Data','r+') as file:
print(json.load(file))
json_contents = json.load(file)
我不明白为什么第三行显示错误: json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)但打印它很好。 我正在阅读的文件只是一个测试:
[{"name": "George", "degree": "Coding"}, {"name": "Connor", "degree": "Science"}]
您已通过第一次调用json.load
到达文件json.load
。 首先将它分配给一个变量,然后打印它。 否则,呼叫file.seek(0)
在调用之间json.load
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.