I am trying to output the difference between two text files using the library difflib in Python 2, with the function HtmlDiff to generate an html file.
V1 = 'This has four words'
V2 = 'This has more than four words'
res = difflib.HtmlDiff().make_table(V1, V2)
text_file = open(OUTPUT, "w")
text_file.write(res)
text_file.close()
However the output html looks like this on a browser:
The display is comparing each single character, making it completely unreadable.
What should I modify for the comparison to be more human-friendly? (e.g. full sentences on each side)
If the input specifies "lines", then the output is also formatted respecting the lines, but it is not displaying the differences:
V1 = ['This has four words']
V2 = ['This has more than four words']
res = difflib.HtmlDiff().make_table(V1, V2)
text_file = open(OUTPUT, "w")
text_file.write(res)
text_file.close()
Resulting html (as viewed on a browser):