I am trying to extract as strings all the differences in 2 files with Python. For example by doing this:
import difflib
first_file_lines = open('first_file', encoding='utf-8').readlines()
second_file_lines = open('second_file', encoding='utf-8').readlines()
difference = difflib.HtmlDiff().make_file(first_file_lines,
second_file_lines, first_file, second_file)
with open(f'difference.html', 'w', encoding='utf-8') as difference_report:
difference_report.write(difference)
I can generate html file and open it in browser to see all the differences as strings. They are highlighted with color coding - green for Added, yellow for Changed and red for Deleted. Instead of making html file with colorcoded marking, I want to extract all differences as strings and put them in something itterable. My ultimate goal is to check if a string of mine is in the newly added strings in the second file. So different approach is welcome.