from pathlib import Path p = Path(__file__).resolve().parent / "zhenyang-ai-console.html" text = p.read_text(encoding="utf-8") start = text.index(" ", start) + len("") new = ( ' \n' ' ' ) p.write_text(text[:start] + new + text[end:], encoding="utf-8") print("patched html", p.stat().st_size)