apppublic/appPublic/myjson.py
2023-02-23 15:17:24 +08:00

23 lines
339 B
Python
Executable File

try:
import ujson as json
except:
import json
import codecs
def loadf(fn,coding='utf8'):
f = codecs.open(fn,'r',coding)
d = json.load(f)
f.close()
return d
def dumpf(obj,fn,coding='utf8'):
f = codecs.open(fn,'w',coding)
json.dump(obj,f)
f.close()
load = json.load
dump = json.dump
loads = json.loads
dumps = json.dumps