示例#1
0
文件: reader.py 项目: yzh979/cbeta
def diff_word_get():
    '''按照词比较两个文件不同'''
    with open('lfile.tmp') as fd:
        lfile = fd.read()
        lfile = list(jieba.cut(lfile))

    with open('rfile.tmp') as fd:
        rfile = fd.read()
        rfile = list(jieba.cut(rfile))

    return diff_ctx(lfile, rfile)
示例#2
0
文件: reader.py 项目: yzh979/cbeta
def diff_line_get():
    '''按照行比较两个文件不同'''
    with open('lfile.tmp') as fd:
        lfile = fd.read()
        lfiles = [line.strip() for line in lfile.splitlines()]

    with open('rfile.tmp') as fd:
        rfile = fd.read()
        rfiles = [line.strip() for line in rfile.splitlines()]

    return diff_ctx(lfile, rfile)
示例#3
0
文件: reader.py 项目: yzh979/cbeta
def diff_get():

    try:
        with open('lfile.tmp') as fd:
            lfile = fd.read()

        with open('rfile.tmp') as fd:
            rfile = fd.read()

        return diff_ctx(lfile, rfile)

    except:
        return {}