删除txt文件里的 聊天记录的时间那一行
f = open("d:\\面试.txt", "r") g = open("d:\\英雄联盟ADC技巧.txt", "w") for line in f.readlines(): if "21:" not in line: g.write(line) f.close() g.close()