From 1def43f7abd7af1438469138ae1405e4cee69929 Mon Sep 17 00:00:00 2001 From: frxz751113 <156018267+frxz751113@users.noreply.github.com> Date: Thu, 12 Sep 2024 18:58:40 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E9=85=92=E5=BA=97=E6=BA=90.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- py/酒店源.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/py/酒店源.py b/py/酒店源.py index 8171e79..f6e6e92 100644 --- a/py/酒店源.py +++ b/py/酒店源.py @@ -1121,6 +1121,21 @@ for line in lines: # 将唯一的行写入新的文档 with open('酒店优选.txt', 'w', encoding="utf-8") as file: file.writelines(unique_lines) + +import datetime +now = datetime.datetime.utcnow() + datetime.timedelta(hours=8) +current_time = now.strftime("%m-%d %H:%M") +# 打开文本文件并将时间添加到开头 +file_path = "酒店优选.txt" +with open(file_path, 'r+', encoding='utf-8') as f: + content = f.read() + f.seek(0, 0) + f.write(f'更新时间,#genre#\n') + f.write(f'请您欣赏,https://vd2.bdstatic.com/mda-mi1dd05gmhwejdwn/sc/cae_h264/1630576203346678103/mda-mi1dd05gmhwejdwn.mp4\n') + f.write(f'{current_time},#genre#\n') + f.write(f'虚情的爱,https://vd2.bdstatic.com/mda-mi1dd05gmhwejdwn/sc/cae_h264/1630576203346678103/mda-mi1dd05gmhwejdwn.mp4\n{content}') + + #任务结束,删除不必要的过程文件 files_to_remove = ['去重.txt', "2.txt", "iptv.txt", "e.txt", "a0.txt", "a.txt", "a1.txt", "b.txt", "c.txt", "c1.txt", "c2.txt", "d.txt", "f.txt", "o1.txt", "o.txt", "酒店源.txt"] for file in files_to_remove: