增加判断

This commit is contained in:
2024-05-29 12:44:28 +08:00
parent 9612365756
commit 92efea224d

View File

@@ -7,6 +7,8 @@ def handle_decimal(string):
if not string: if not string:
return "" return ""
string = re.sub(r'[^0-9.]', '', string) string = re.sub(r'[^0-9.]', '', string)
if "." not in string:
return string
front, back = string.rsplit('.', 1) front, back = string.rsplit('.', 1)
front = front.replace(".", "") front = front.replace(".", "")
if back: if back: