コンテンツへスキップ
メニュー
この質問にフラグが付けられました
2 返信
7423 ビュー

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 :)

関連投稿 返信 ビュー 活動
1
1月 24
4487
1
8月 15
3149
2
3月 15
4494
1
3月 15
31759
1
3月 15
3823