Use python's difflib. For example:
import difflib
file1 = open('file1.html', 'r').readlines()
file2 = open('file2.html', 'r').readlines()
htmlDiffer = difflib.HtmlDiff()
htmldiffs = htmlDiffer.make_file(file1, file2)
with open('comparison.html', 'w') as outfile:
outfile.write(htmldiffs)
This will create an html file named comparison.html
containing the diffs between the two html files file1.html
and file2.html
. Here file1.html
is considered the source, or original version whichever is more appropriate for your case, and file2.html
is the changed version or new version, again, whichever is more appropriate here.
Hope that helps!