path = 'c:/NeoZQYY/docs/h5_ui/compare/AGENT-PLAYBOOK.md' with open(path, 'rb') as f: raw = f.read() crlf = b'\r\n' in raw lines = raw.decode('utf-8').replace('\r\n', '\n').split('\n') # Remove duplicate line 460 (0-indexed) - the OLD标准方法 line del lines[460] doc = '\n'.join(lines) # Fix U+9559 (镙) -> U+9547 (锚) throughout doc = doc.replace('\u9559\u70b9', '\u9547\u70b9') # 镙点 -> 锚点 # Also fix '値' (if any stray U+5024 that differs) # U+5024 ord=20516 is same as '值' so no fix needed count_jiao = doc.count('\u9547\u70b9') # 锚点 count_bad = doc.count('\u9559\u70b9') # 镙点 print(f'锚点 occurrences: {count_jiao}, 镙点 remaining: {count_bad}') print(f'Total lines: {len(lines)}') if crlf: doc = doc.replace('\n', '\r\n') with open(path, 'wb') as f: f.write(doc.encode('utf-8')) print('Done')