Перейти к содержимому
Меню
Чтобы взаимодействовать с сообществом, необходимо зарегистрироваться.
Этот вопрос был отмечен
2 Ответы
7390 Представления

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
4430
1
авг. 15
3120
2
мар. 15
4436
1
мар. 15
31717
1
мар. 15
3788