import json filename = 'lovenum.json' with open(filename) as obj: i = obj.read() i = int(i) x = input('set a num : ') x = int(x) if x == i: print('\n\ti know u favorite num is : '+str(i)) else: x = input('please tell me you favorite num : ') x = int(x) with open(filename,'w') as obj: json.dump(x,obj) print('\n\tOK ,im remember U favorite num: '+str(x))
最后修改:2022 年 12 月 05 日
© 允许规范转载