Python:将按字母顺序拼写的数字转换为数字吗? [英] Python: convert alphabetically spelled out numbers to numerics?

查看:192
本文介绍了Python:将按字母顺序拼写的数字转换为数字吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个图书馆,服务或代码建议,以将拼写的数字和金额(例如,三十五美元和十五美分",一分五")转换为数字($ 35.15,1.5).有建议吗?

I'm looking for a library, service, or code suggestions to turn spelled out numbers and amounts (eg. "thirty five dollars and fifteen cents", "one point five") into numerics ($35.15, 1.5) . Suggestions?

推荐答案

前一段时间,我写了一些代码来对整数进行处理:

I wrote some code to do this for integers a while ago: http://github.com/ghewgill/text2num

随意分叉和破解.

这篇关于Python:将按字母顺序拼写的数字转换为数字吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆