Ir al contenido
Menú
Se marcó esta pregunta
2 Respuestas
7676 Vistas

i to all,

how to round 2 decimals, even if the value are 00

example : 12.00 

can i do this on python

regards 

Avatar
Descartar

We can achieve using python using help of "%.2f" format specifier. Can you explain more your requirement ? where you want to put 2 decimal ? i.e. inside any report or inside any web form etc...

Mejor respuesta

Python only displays what's needed, so it displated 10.0

If it's the matter of printing it as 10.00.

To do that.

>>> d = 10
>>> print "Value: %.2f" % float(d)
Value: 10.00
>>>

Hope this will help you.

Avatar
Descartar
Autor

thanks Parikshit :)

Publicaciones relacionadas Respuestas Vistas Actividad
1
ene 24
4795
1
ago 15
3444
2
mar 15
4830
1
mar 15
32156
1
mar 15
4014