Hi
i'm new to python, i want to generate results by comparing two files(txt/xls)line by line as Pass or Fail. i was able to achieve this using difflib and htmldiff(). comparison works fine but not able to add third column as results which should return pass/fail for corresponding line. can any one help me with this?

Note: number of lines in files are not equal.

Recommended Answers

All 2 Replies

Can you give us an example of your code?

import difflib
fromfile = "Engine_Result.txt"
tofile = "Fiery_Result.txt"
fromlines= open(fromfile, 'U').readlines()
tolines= open(tofile, 'U').readlines()
file = open("Results.htm", "w")
d=difflib.HtmlDiff()
if d:
result =d.make_file(fromlines, tolines, fromfile, tofile)
else:
result =d.context_diff(fromlines, tolines,fromfile,tofile)
file.write(result)
file.close

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.