#数据储存
import json
list=[1,2,3,4,5]
filename='abc.json'
with open(filename,'w') as f:
json.dump(list,f)
filename='abc.json'
with open(filename) as f:
g=json.load(f)
print(g)
import json
def fun():
filename='name.json'
try:
with open(filename) as f:
name=json.load(f)
except Exception:
name=input('Please input your name')
with open(filename,'w') as f:
json.dump(name,filename)
print(f'{name},I will remember you')
else:
print(f'welcome back,{name}')
fun()