import json
# jsonPath = r'D:/PythonProject/Editor/main/template2.json';
jsonPath = r'D:/PythonProject/Editor/main/template.json';
def load():
with open(jsonPath,'r') as f:
data = json.load(f)
return data
data = load()
遇到的麻烦:
解决方案如下:
jsonPath = 'X:\x\c\info.json' with open(jsonPath, 'r',encoding='UTF-8') as f: data = json.load(f)