是否有 django 模板过滤器来显示百分比? [英] Is there a django template filter to display percentages?
本文介绍了是否有 django 模板过滤器来显示百分比?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想要类似于标准库中的字符串格式.
'%' 百分比.乘以数字按 100 并以固定 ('f') 显示格式,后跟百分号.
'%' Percentage. Multiplies the number by 100 and displays in fixed ('f') format, followed by a percent sign.
推荐答案
string.Formatter()
的新特性意味着 Django 不太可能内置支持它.编写或查找实现它的模板标记或过滤器.
The newness of string.Formatter()
means that Django is not likely to support it built-in. Either write or find a template tag or filter that implements it.
这篇关于是否有 django 模板过滤器来显示百分比?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文