在Google App Engine Python中使用地区格式化货币
我正在尝试在使用Python 2.7的Google App Engine上将货币格式化为美国的标准格式。这是我使用的代码:
import locale
locale.setlocale( locale.LC_ALL, 'US')
tFloatCash = 50.00
tStringCash = locale.currency(tFloatCash)
这段代码在交互式命令行中运行得很好。但是,在Google App Engine上运行时,我遇到了这个错误:
File "***", line 138, in post
locale.setlocale( locale.LC_ALL, 'US')
File "/base/python27_runtime/python27_dist/lib/python2.7/locale.py", line 531, in setlocale
return _setlocale(category, locale)
Error: unsupported locale setting
我该怎么做才能解决这个问题?有没有其他的货币格式化库可以让我快速实现对浮点数的格式化?
1 个回答
9