Auto-format code 🧹🌟🤖
This commit is contained in:
parent
9a1b9d1949
commit
93d2047c7a
@ -527,9 +527,9 @@ def chinese_to_number(chinese):
|
|||||||
unit = 1
|
unit = 1
|
||||||
num = 0
|
num = 0
|
||||||
# 处理特殊情况:以"十"开头时,在前面加"一"
|
# 处理特殊情况:以"十"开头时,在前面加"一"
|
||||||
if chinese.startswith('十'):
|
if chinese.startswith("十"):
|
||||||
chinese = '一' + chinese
|
chinese = "一" + chinese
|
||||||
|
|
||||||
# 如果只有一个字符且是单位,直接返回其值
|
# 如果只有一个字符且是单位,直接返回其值
|
||||||
if len(chinese) == 1 and chinese_to_arabic[chinese] >= 10:
|
if len(chinese) == 1 and chinese_to_arabic[chinese] >= 10:
|
||||||
return chinese_to_arabic[chinese]
|
return chinese_to_arabic[chinese]
|
||||||
@ -544,7 +544,7 @@ def chinese_to_number(chinese):
|
|||||||
else:
|
else:
|
||||||
num += val * unit
|
num += val * unit
|
||||||
result += num
|
result += num
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user