filecmp模块多文件对比

[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]#

    原文作者:付炜超
    原文地址: https://www.jianshu.com/p/7c52f76d5db3
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞