16 lines
359 B
Python
16 lines
359 B
Python
|
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
|