Skip to Content
Меню
Вам необхідно зареєструватися, щоб взаємодіяти зі спільнотою.
Це запитання позначене
2 Відповіді
7438 Переглядів

i to all,

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

example : 12.00 

can i do this on python

regards 

Аватар
Відмінити

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

Найкраща відповідь

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.

Аватар
Відмінити
Автор

thanks Parikshit :)

Related Posts Відповіді Переглядів Дія
1
січ. 24
4499
1
серп. 15
3171
2
бер. 15
4506
1
бер. 15
31780
1
бер. 15
3832