中文数字转阿拉伯数字

import cn2an

# 在 strict 模式下,只有严格符合的才可以进行转化
output = cn2an.cn2an("一百二十三", "strict")
# or output = cn2an.cn2an("一二三")
print(output)
# 123

# 在 normal 模式下,还可以将 一二三 进行转化
output = cn2an.cn2an("一二三", "normal")
print(output)
# 123

# 在 smart 模式下,还可以将混合描述的 1百23 进行转化 (开发中)
output = cn2an.cn2an("1百23", "smart")
print(output)
# 123


# 在 low 模式下,数字转化为小写的中文数字
output = cn2an.an2cn("123", "low")
# or output = cn2an.an2cn("123")
print(output)
# 一百二十三

# 在 up 模式下,数字转化为大写的中文数字
output = cn2an.an2cn("123", "up")
print(output)
# 壹佰贰拾叁

# 在 rmb 模式下,数字转化为人民币专用的描述
output = cn2an.an2cn("123", "rmb")
print(output)
# 壹佰贰拾叁元整

# 在 smart 模式下,可以将混合描述数字转化为小写的中文数字 (开发中)
utput = cn2an.an2cn("1百23", "smart")
print(output)
# 一百二十三

了解更多分析及数据抓取可查看:
http://cloud.yisurvey.com:9081/html/d8acf20b-342f-4806-8dcc-5e6a8d00881d.html?ly=csdn

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值