Se rendre au contenu
Menu
Cette question a été signalée
2 Réponses
7397 Vues

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
Ignorer

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...

Meilleure réponse

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
Ignorer
Auteur

thanks Parikshit :)

Publications associées Réponses Vues Activité
1
janv. 24
4472
1
août 15
3137
2
mars 15
4456
1
mars 15
31734
1
mars 15
3813