

# https://www.globalsino.com/ICs/
# Comparing two text files: use HtmlDiff to generate an HTML table that
# shows a side by side, line by line comparison of the text with inter-line
# and intra-line change highlights.


import difflib
from pathlib import Path

path_A = r"C:\GlobalSino20230219\ICs\TextFileForPage2410\Text2410a.txt"
path_B = r"C:\GlobalSino20230219\ICs\TextFileForPage2410\Text2410e.txt"
WebPagePath = r"C:\GlobalSino20230219\ICs\TextFileForPage2410\diff.html"


first_file_lines = Path(path_A).read_text().splitlines()
second_file_lines = Path(path_B).read_text().splitlines()

html_diff = difflib.HtmlDiff().make_file(first_file_lines, second_file_lines)
Path(WebPagePath).write_text(html_diff)
