# json_file = open(new_json_file_path, 'r', encoding='GBK') # 这个就不会报错
json_file = open(new_json_file_path, 'r', encoding='utf-8') # 报错
json.load(json_file)
# 包装成函数:
def load_json_file(json_path):
try:
json_file = open(json_path, 'r', encoding='gbk')
file_dict = json.load(json_file)
except:
json_file = open(json_path, 'r', encoding='utf-8')
file_dict = json.load(json_file)
return file_dict