# -*- coding: utf-8 -*- """ @Time : 2023/2/21 11:51 @Author : @FileName: @Software: @Describe: """ path = '../data/11篇汇总txt.txt' path_new = '../data/11篇汇总txt_new.txt' with open(path, 'r', encoding="utf-8") as f: lines = [x.strip() for x in f if x.strip() != ''] data = [] for i in lines: dan = i.strip() print(dan) if dan == "。": continue elif dan == "+++++++++++++++++++++++++++++++++++++++++++++++++@@@@@@@@@@@@@@@@@@@": data.append("嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯嚯") else: data.append(dan) with open(path_new, "w", encoding='utf-8') as file: for i in data: file.write(i + '\n') file.close()