a

时间:
import os # 遍历文件夹中的每一个txt文件 for filename in os.listdir('.'): if filename.endswith('.txt'): # 打开txt文件并以UTF-8模式读取内容 with open(filename, 'r', encoding='utf-8') as file: content = file.read() # 删除 content = content.replace('TCL', '') # 将修改后的内容以UTF-8模式写回txt文件 with open(filename, 'w', encoding='utf-8') as file: file.write(content)