import os

文件路径

file_path = ‘1.txt’
file_path2 = ‘2.txt’

读取文件内容

with open(file_path, ‘r’) as file:
content = file.read()

替换文本中的多个不同字符串

content = content.replace(‘替换√2’, ‘替换为@Outlook.com’)

… 可以继续替换更多字符串

写回新的文件内

with open(file_path2, ‘w’) as file:
file.write(content)