p = r"E:\GitHub\blog\bot-go\cmd\writebot\main.go" with open(p, "r", encoding="utf-8") as f: c = f.read() c = c.replace('"net/http"\n', '') with open(p, "w", encoding="utf-8", newline="\n") as f: f.write(c) print("fixed")