1
7
我猜你在说蟒蛇。 http://code.google.com/p/python-money/ “在python中使用货币和货币的原语”-标题不言自明:) |
2
12
不要使用浮点数来表示货币。浮点数不能准确地用十进制表示数字。你将以复合舍入错误的噩梦结束,并且无法在货币之间可靠地转换。见 Martin Fowler's short essay on the subject . 如果您决定编写自己的类,我建议您基于 decimal 数据类型。 我不认为python money是一个很好的选择,因为它的维护时间不长,它的源代码有一些奇怪的、无用的代码,而交换货币只是被破坏了。 尝试 py-moneyed . 这是对python金钱的改进。 |
5
4
你可以看看这个图书馆: python-money . 因为我没有这方面的经验,我不能评论它的实用性。 您可以使用一个“技巧”将货币作为整数进行处理:
|
6
1
简单,重量轻,但可扩展的理念:
你可以:
|
July · 如何定义数字间隔,然后四舍五入 1 年前 |
user026 · 如何根据特定窗口的平均值(行数)创建新列? 1 年前 |
Ashok Shrestha · 需要追踪特定的颜色线并获取坐标 1 年前 |
Nicote Ool · 在FastApi和Vue3中获得422 1 年前 |
Abdulaziz · 如何对集合内的列表进行排序[重复] 1 年前 |
asmgx · 为什么合并数据帧不能按照python中的预期方式工作 1 年前 |