def chineseNumber2Int(strNum: str):
result = 0
temp = 1 # 存放一个单位的数字如:十万
count = 0 # 判断是否有chArr
cnArr = ['壹', '贰', '叁', '肆', '伍', '陆', '柒', '捌', '玖']
chArr = ['拾', '佰', '仟', '万', '亿']
for i in range(len(strNum)):
b = True
c = strNum[i]
for j in range(len(cnArr)):
if c == cnArr[j]:
if count != 0:
result += temp
count = 0
temp = j + 1
b = False
break
if b:
for j in range(len(chArr)):
if c == chArr[j]:
if j == 0:
temp *= 10
elif j == 1:
temp *= 100
elif j == 2:
temp *= 1000
elif j == 3:
temp *= 10000
elif j == 4:
temp *= 100000000
count += 1
if i == len(strNum) - 1:
result += temp
return result
Mac电脑安装Python软件后怎么查看版本号(附下载地址)
上面是“Python语言如何实现大写汉字和数字的转换”的全面内容,想了解更多关于 后端开发 内容,请继续关注web建站教程。
当前网址:https://ipkd.cn/webs_4292.html
workflows工作流
图生图局部重绘ComfyUI工作流
一盒用五颜六色的食材烹制的热气腾腾的寿司
城市里出现一只可爱的小生物ComfyUI工作流
3d卡通风格多彩头发的女人
红伞伞蓝杆杆云南蘑菇群ComfyUI工作流
一辆机器人虎狮高端混合动力车ComfyUI工作流
懂王特朗普3d漫画ComfyUI工作流
乒乓卡通3d人物
猜你喜欢
声明:本站提供的所有资源部分来自互联网,如果有侵犯您的版权或其他权益,请发送到邮箱:admin@ipkd.cn,我们会在看到邮件的第一时间内为您处理!

会议人员60s签到倒计时插件
js导出excel插件(兼容mac电脑Numbers表格)
css3+js菜单点击动态效果
canvas经线动画走到效果
iframe开发admin后台
自动打字效果(惊喜在后面)
2023年程序猿如何给自己开启一场烟花盛会
纯css制作卡通头像(随鼠标转头)






