运行下面一串代码,然后就报错了
import json
json_str = '{"name":"张三", "age":"18"}'
json_dict = json.loads(json_str)
print(type(json_dict))
Traceback (most recent call last):
File "D:/python/test/实例练习/json库.py", line 14, in
json_dict = json.loads(json_str)
File "D:\Python38-32\lib\json_init_.py", line 357, in loads
return _default_decoder.decode(s)
File "D:\Python38-32\lib\json\decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "D:\Python38-32\lib\json\decoder.py", line 353, in raw_decode
obj, end = self.scan_once(s, idx)
json.decoder.JSONDecodeError: Expecting ',' delimiter: line 1 column 13 (char 12)
怎样能不报错呢