原写入语句:
with open(path, "w", encoding="utf-8") as f: f.write(json.dumps(result))
增加ensure_ascii=False (中文字符属于非ascii字符)可解决乱码问题,增加indent=2即缩进,如下:
with open(path, "w", encoding="utf-8") as f: f.write(json.dumps(result, ensure_ascii=False, indent=2))
原写入语句:
with open(path, "w", encoding="utf-8") as f: f.write(json.dumps(result))
增加ensure_ascii=False (中文字符属于非ascii字符)可解决乱码问题,增加indent=2即缩进,如下:
with open(path, "w", encoding="utf-8") as f: f.write(json.dumps(result, ensure_ascii=False, indent=2))