2024-05-15 14:34:36 发布
网友
我想不出怎么把我的货币设为0位小数。现在它总是把0.00放在我的货币后面。在
locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') damn = locale.currency(self.damn, grouping=True).replace('$','') + " Dmn"
在自我。该死总是整数。在
看来你只是对分组感兴趣。您不需要为此使用currency函数。使用locale.format():
locale.format()
import locale locale.setlocale(locale.LC_ALL, 'en_US.UTF-8') damn = '{0} Dmn'.format(locale.format('%d', self.damn, True))
如果你不依赖locale的内容,你也可以用string.format()来分组:
locale
string.format()
看来你只是对分组感兴趣。您不需要为此使用currency函数。使用
locale.format()
:如果你不依赖
^{pr2}$locale
的内容,你也可以用string.format()
来分组:相关问题 更多 >
编程相关推荐