import re, os, sys
base = os.path.dirname(os.path.abspath(__file__))
p = os.path.join(base, "index_main.html")
html = open(p, encoding="utf-8").read()

old_row = '["uva", "商学院", "Accounting", "Accounting", "MS", "https://records.ureg.virginia.edu/content.php?catoid=44&navoid=3134", "biz", "details/uva-accounting-ms.html"]'
new_row = '["uva", "商学院", "Accounting", "会计学", "MS", "https://records.ureg.virginia.edu/content.php?catoid=44&navoid=3134", "biz", "details/uva-accounting-ms.html"]'

assert html.count(old_row) == 1, f"CATD 行定位次数: {html.count(old_row)}"
html = html.replace(old_row, new_row)
assert new_row in html
open(p, "w", encoding="utf-8").write(html)
print("CATD uva-msacc 目录层 n 同步为「会计学」, bytes:", len(html.encode("utf-8")))
