import os,json
from conf import settings
def select(name):
user_path = os.path.join(settings.BASE_DB,'%s.txt'%name)
if os.path.exists(user_path):
with open(user_path,'r',encoding='utf-8')as f:
dic = json.load(f)
return dic
else:
return None
def save(dic):
user_path = os.path.join(settings.BASE_DB,'%s.txt'%dic['name'])
with open(user_path,'w',encoding='utf-8')as f:
json.dump(dic,f,ensure_ascii=False)
f.flush()