第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定
已解決430363個(gè)問(wèn)題,去搜搜看,總會(huì)有你想問(wèn)的

Python - 不能從 JSON 導(dǎo)入?

Python - 不能從 JSON 導(dǎo)入?

胡子哥哥 2021-06-27 11:19:25
我有一個(gè)類將包含字符串的列表轉(zhuǎn)儲(chǔ)到 .json 文件中,另一個(gè)類則加載此文件。但是,我收到了我不明白的奇怪錯(cuò)誤 - 這是 .json 文件的內(nèi)容(示例): ["1", "1", "1", "1", "1", "1", "1", "11", "1", "1", "1.1.1.1", "11.11.11.11"]這是讀取另一個(gè)類中的 .json 文件的代碼: with open('test.json','a+') as infile:        if os.stat('test.json').st_size != 0:            jsonimport = json.load(infile)我在想,如果文件不存在,Python 中的 open() 不會(huì)創(chuàng)建文件,但我沒(méi)有正常讀取文件,而是使用 JSON 加載數(shù)據(jù)...這是錯(cuò)誤:    File "C:\Users\Administrator\Documents\QTTestGIT\IPv4calc.py", line 12, in __init__    self.CallPrompt()  File "C:\Users\Administrator\Documents\QTTestGIT\IPv4calc.py", line 18, in CallPrompt    jsonimport = json.load(infile)  File "C:\Program Files\Python36\lib\json\__init__.py", line 299, in load    parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)  File "C:\Program Files\Python36\lib\json\__init__.py", line 354, in loads    return _default_decoder.decode(s)  File "C:\Program Files\Python36\lib\json\decoder.py", line 339, in decode    obj, end = self.raw_decode(s, idx=_w(s, 0).end())  File "C:\Program Files\Python36\lib\json\decoder.py", line 357, in raw_decode    raise JSONDecodeError("Expecting value", s, err.value) from Nonejson.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)Process finished with exit code 1
查看完整描述

1 回答

  • 1 回答
  • 0 關(guān)注
  • 221 瀏覽
慕課專欄
更多

添加回答

舉報(bào)

0/150
提交
取消
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)