[英]Why am I getting a file not found error when reading a pdf file on jupyter notebook?
[英]why am i getting this error when reading a .json file?
所以我有這個函數來讀取一個 json 文件並返回通過它傳遞的文件中的數據字典
def file_read(source):
with open(source) as file:
data = file.read()
dictionary = json.loads(data)
return dictionary
我正在使用的文件名為“users.json”並已格式化
{"Jim":("password", "MMA60V")}
但是,每當我嘗試運行代碼以讀取“users.json”中的內容時,我都會收到此錯誤
json.decoder.JSONDecodeError: Expecting value: line 1 column 8 (char 7)```
does anyone know why this is happening and a possible solution thank you.
這不是正確的 JSON,並且由於您使用的是json.loads
,因此會出現錯誤。
將 JSON 粘貼到https://jsonlint.com/ 中,您可以看到輸入無效。 JSON 不支持元組。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.