示例#1
0
def read_file(filepath):
    _filepath = resolve_file_path(filepath)
    if os.path.exists(_filepath):
        fc = open(_filepath, 'r')
        obj = json.load(fc, encoding='utf-8')
        fc.close()
        return obj
    else:
        return None
示例#2
0
文件: jsonfile.py 项目: zuberv/xceltv
def read_file(filepath):
    _filepath = resolve_file_path(filepath)
    if os.path.exists(_filepath):
        fc = open(_filepath, 'r')
        obj = json.load(fc, encoding='utf-8')
        fc.close()
        return obj
    else:
        return None
示例#3
0
def write_file(filepath, obj):
    _filepath = resolve_file_path(filepath)
    fc = open(_filepath, 'w')
    status = json.dump(obj, fc, encoding='utf-8')
    fc.close()
    return status
示例#4
0
文件: jsonfile.py 项目: zuberv/xceltv
def write_file(filepath, obj):
    _filepath = resolve_file_path(filepath)
    fc = open(_filepath, 'w')
    status = json.dump(obj, fc, encoding='utf-8')
    fc.close()
    return status