json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 1)

应该是表示json内容无效。如果使用之前判断一下。会跳过无效数据。

#Add a judgment
def is_json(file):
try:
json.loads(file)
except Exception as e:
return e
return True

参考https://jingyan.baidu.com/article/e75aca852664a7142edac6c1.html

你可能感兴趣的:(Python,json)