diff --git a/py/iptv流畅度检测.py b/py/iptv流畅度检测.py index b1f018f..cde2797 100644 --- a/py/iptv流畅度检测.py +++ b/py/iptv流畅度检测.py @@ -663,6 +663,16 @@ 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: