From 6cb8cda3067748ddaf12ec4c0dd8d9a9d71222cd Mon Sep 17 00:00:00 2001 From: frxz751113 <156018267+frxz751113@users.noreply.github.com> Date: Sun, 18 Aug 2024 18:37:41 +0800 Subject: [PATCH] =?UTF-8?q?Update=20iptv=E6=B5=81=E7=95=85=E5=BA=A6?= =?UTF-8?q?=E6=A3=80=E6=B5=8B.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- py/iptv流畅度检测.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/py/iptv流畅度检测.py b/py/iptv流畅度检测.py index cde2797..7706591 100644 --- a/py/iptv流畅度检测.py +++ b/py/iptv流畅度检测.py @@ -663,16 +663,6 @@ for line in fileinput.input("分类.txt", inplace=True): #打开临时文件 line = line.replace("CCTV17,", "CCTV17-农业农村,") print(line, end="") -# 定义要处理的文件路径 -file_path = '分类.txt' -# 读取文件内容 -with open(file_path, 'r', encoding='utf-8') as file: - lines = file.readlines() -# 去除空白行 -non_blank_lines = [line for line in lines if line.strip()] -# 重新写入文件 -with open(file_path, 'w', encoding='utf-8') as file: - file.writelines(non_blank_lines) # 打开文档并读取所有行 with open('分类.txt', 'r', encoding="utf-8") as file: @@ -689,11 +679,11 @@ for line in lines: # 将唯一的行写入第一个文件 with open('组播优选.txt', 'w', encoding="utf-8") as file: for line in unique_lines: - file.write(line + '\n') # 确保每行后面有换行符 + file.write(line') # 确保每行后面有换行符 + '\n # 将唯一的行追加到第二个文件 with open('综合源.txt', 'a', encoding="utf-8") as file: for line in unique_lines: - file.write(line + '\n') # 确保每行后面有换行符 + file.write(line) # 确保每行后面有换行符 + '\n'