开发者

Getting float=04 out of int=4

I need to convert integers into two decimal float开发者_如何学Python numbers. So if i have an integer 3 i want it to be float 03. But if i have an two digit integer 33, i want it to be float 33.


The float value will always just be the actual number value. If you want to display that value and have to appear with a leading 0, you will have to use string formatting and the format options to produce "03" from a value of 3.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜