2022-06-21 19:05:14 +08:00
|
|
|
try:
|
|
|
|
import ujson as json
|
|
|
|
except:
|
|
|
|
import json
|
|
|
|
|
2019-07-16 16:33:07 +08:00
|
|
|
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
|
2022-06-21 19:05:14 +08:00
|
|
|
dumps = json.dumps
|