niming_igapi/utils/settingLoader.py

16 lines
359 B
Python
Raw Permalink Normal View History

2024-11-22 02:14:01 +08:00
import json
def loadset():
with open("./settings.json", "r", encoding = "utf-8") as f:
d = json.load(f)
return d
def writeset(name:str, value):
# 寫入
d:dict = loadset()
d[name] = value
with open("./settings.json", "w", encoding = "utf-8") as f:
json.dump(d, f, ensure_ascii=False)
return d