美文网首页python自动化运维
filecmp模块多文件对比

filecmp模块多文件对比

作者: 如来自然 | 来源:发表于2016-01-15 10:49 被阅读37次

    [root@www difflib]# vim diff_more_file.py

    !/usr/bin/env python

    import filecmp

    test1 =raw_input("please input you test1 An absolute path : ")
    test2 =raw_input("please input you test2 An absolute path : ")
    file1 = raw_input("please input you want contrast file: ")
    file2 = raw_input("please input you want contrast file: ")

    files=[file1,file2]
    contrast = filecmp.cmpfiles(test1,test2,files)
    print contrast

    测试:

    [root@www difflib]# python diff_more_file.py
    please input you test1 An absolute path : dir1/
    please input you test2 An absolute path : dir2/
    please input you want contrast file: diff.html
    please input you want contrast file: diff.htmlv2
    (['diff.html', 'diff.htmlv2'], [], []) #匹配 、不匹配 、错误。
    [root@www difflib]#

    相关文章

      网友评论

        本文标题:filecmp模块多文件对比

        本文链接:https://www.haomeiwen.com/subject/agdhkttx.html