Django float format get only digits after floating point

后端 未结 3 885
误落风尘
误落风尘 2021-01-16 06:52

Is there a django template filter to get only digits after the floating point?

For example :

2.34 --> 34
2.00 --> 00
1.10 --> 10
         


        
3条回答
  •  悲哀的现实
    2021-01-16 07:58

    It's better to write your own filter, but if you don't wanna do it I can propose you one more not optimal "lazy" solution:

    {{ value|stringformat:"f"|slice:"-6:-4" }}
    

提交回复
热议问题