[英]How to print number with commas as thousands separator and decimal places in Python/Django
I'm trying to display numbers in my Django templates with 我正试图在我的Django模板中显示数字
eg 76384.8739439 -> 76,384.87 例如76384.8739439 - > 76,384.87
Django has template tags to achieve both these. Django有模板标签来实现这两个目标。
I can't seem to find a way to do both at the same time without writing my own custom template filter. 我似乎无法在不编写自己的自定义模板过滤器的情况下同时找到两种方法。 Anybody know of an easier solution?
有人知道更简单的解决方案吗?
{{ value|floatformat:2|intcomma }}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.