1import difflib 2import os 3 4def compare_file(): 5 if os.path.exists(r'result.html'): 6 os.remove(r'result.html') 7 f = open(r'../libc-test/REPORT','r') 8 a = f.readlines() 9 f.close() 10 f = open(r'REPORT','r') 11 b = f.readlines() 12 f.close() 13 if a != b: 14 compare = difflib.HtmlDiff() 15 c = compare.make_file(a,b) 16 f = open(r'result.html','w') 17 f.write(c) 18 f.close 19if __name__ == '__main__': 20 compare_file()