在当前项目下新建一个文件夹,把字典的json文件放入其中,比如你的json文件叫a.json
def load_config():
with open(os.path.dirname(os.path.abspath(__file__))+"/config/a.json".format(sys.path[0]), "rb") as f:
print("Load default config")
return json.load(f)
temp = load_config()
在当前项目下新建一个文件夹,把字典的json文件放入其中,比如你的json文件叫a.json
def load_config():
with open(os.path.dirname(os.path.abspath(__file__))+"/config/a.json".format(sys.path[0]), "rb") as f:
print("Load default config")
return json.load(f)
temp = load_config()