From 2e86b1454dd68d9657a20d87c479e47ceb363c73 Mon Sep 17 00:00:00 2001 From: frxz751113 <156018267+frxz751113@users.noreply.github.com> Date: Sat, 14 Sep 2024 10:10:27 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E6=9B=B4=E6=96=B0=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=90=8D.py?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- py/更新文件名.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/py/更新文件名.py b/py/更新文件名.py index fc3fc23..2da43b6 100644 --- a/py/更新文件名.py +++ b/py/更新文件名.py @@ -27,9 +27,9 @@ def rename_files(): # 检查文件是否是需要重命名的文件(根据初始文件名判断) if any(old_filename.endswith(init_filename) for init_filename in initial_filenames): if last_update_time and old_filename.startswith(f"{last_update_time}"): - # 如果文件名已包含上次时间,提取原文件名部分并替换为当前时间 - original_filename = old_filename[len(last_update_time):] - new_filename = f"{current_date}{original_filename}" + # 如果文件名已包含上次时间,提取上次时间后的文件名部分,然后替换上次时间为当前时间 + original_filename_after_last_time = old_filename[len(last_update_time):] + new_filename = f"{current_date}{original_filename_after_last_time}" else: # 首次重命名,直接加上当前时间 new_filename = f"{current_date}{old_filename}"