From e73e10d62daacebd1ff1fee0f7002e39ede1080c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=AE=B8=E6=A0=87?= Date: Thu, 24 Jul 2025 15:05:01 +0800 Subject: [PATCH] =?UTF-8?q?feat=20=F0=9F=90=9B:add?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/tools/draw_picture.py | 2 +- app/tools/find_before_word.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/tools/draw_picture.py b/app/tools/draw_picture.py index f4d40d0..b25aec9 100644 --- a/app/tools/draw_picture.py +++ b/app/tools/draw_picture.py @@ -43,7 +43,7 @@ def plot_electricity_comparison(year, month, day, data): valid_data = {} for title, values in data.items(): if "昨天" in values and "今天" in values: - if values["昨天"] is not None and values["今天"] is not None: + if values["昨天"] is not None and values["今天"] is not None and values["昨天"]!="" and values["今天"]!="": valid_data[title] = values # 如果没有有效的数据,返回 None 或其他指示 diff --git a/app/tools/find_before_word.py b/app/tools/find_before_word.py index 191e759..997cdf3 100644 --- a/app/tools/find_before_word.py +++ b/app/tools/find_before_word.py @@ -75,9 +75,9 @@ def extract_overload_info_from_previous_day( # 提取过载台数信息 overload_info = None for para in doc.paragraphs: - if re.search(r"过载(\d+)[条台]", para.text): + if re.search(r"过载(\d+)(?:[条台]|\s*)?", para.text): overload_info = ( - re.search(r"过载(\d+)[条台]", para.text) + re.search(r"过载(\d+)(?:[条台]|\s*)?", para.text) .group() .replace("过载", "") .replace("台", "")