From b332aa00ddb8845864cd8d2ee578f6dd1b56948d Mon Sep 17 00:00:00 2001 From: liuyebo <1515783401@qq.com> Date: Tue, 15 Oct 2024 11:29:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E9=87=91=E9=A2=9D=E5=A4=84?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- util/data_util.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/util/data_util.py b/util/data_util.py index be46097..e97e763 100644 --- a/util/data_util.py +++ b/util/data_util.py @@ -9,9 +9,15 @@ from util import common_util def handle_decimal(string): if not string: return '' + original_string = string string = re.sub(r'[^0-9.]', '', string) if not string: - return '' + # 可能抓到大写金额了,尝试用大写金额解析 + try: + return common_util.chinese_money_to_number(original_string) + except Exception as e: + logging.warning('大写金额解析失败', exc_info=e) + return '' if '.' not in string: if len(string) > 2: result = string[:-2] + '.' + string[-2:]