python3实现数字转中⽂数字转中⽂
封装好的代码
def字符串中的数字转汉字(str_data):
"""
将字符串中的数字转为汉字
:param str_data: 传⼊字符串
:return: 返回数字转成汉字后的字符串
"""
python在线编辑器python3ansform(str_data,"an2cn")
其他⽤法⽰例代码
import cn2an
# 在 low 模式(默认)下,数字转化为⼩写的中⽂数字
output = cn2an.an2cn("123")
# 或者
数据库系统创建的步骤output = cn2an.an2cn("123","low")
# output:
# ⼀百⼆⼗三
# 在 up 模式下,数字转化为⼤写的中⽂数字
output = cn2an.an2cn("123","up")
# output:
# 壹佰贰拾叁matlab为什么被禁
# 在 rmb 模式下,数字转化为⼈民币专⽤的描述
output = cn2an.an2cn("123","rmb")
# output:
# 壹佰贰拾叁元整
# 以上三种模式均⽀持负数
output = cn2an.an2cn("-123","low")
subplot 2 2 3 是什么意思# output:
视频特效制作软件app
# 负⼀百⼆⼗三
# 以上三种模式均⽀持⼩数
output = cn2an.an2cn("1.23","low")
htmltextarea设置字体加粗# output:
# ⼀点⼆三

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。