如何在python中将整数转换为等效的字符串?

Roo*_*sal -1 python

我想将转换100One Hundred或任何数字转换为其等效的字符串.

我想避免写一个冗长的程序.最好的方法是什么?

fab*_*ioM 8

您可以使用以下软件包humanize:https://pypi.python.org/pypi/humanize

>>> import humanize
>>> humanize.intcomma(12345)
'12,345'
>>> humanize.intword(123455913)
'123.5 million'
>>> humanize.intword(12345591313)
'12.3 billion'
>>> humanize.apnumber(4)
'four'
>>> humanize.apnumber(41)
'41'
Run Code Online (Sandbox Code Playgroud)