跳至内容
菜单
此问题已终结
1 回复
4230 查看

Hallo,

I want to ask.. How to remove decimal if the value is zero. Example 123,456,789.00 <--- how to remove 00 ?

Thanks

形象
丢弃
最佳答案

I think in python you can do something like:

if(num.find(".00")){      #maybe this find method don't works, so see below

int(num)

}


Or directly, if you don't want do the condition:   int(num)

Examples:

num=0.999 -> int(num) -> num=0

num=123.456 -> int (num) -> num=123

形象
丢弃
相关帖文 回复 查看 活动
1
9月 24
3099
1
4月 24
1648
2
1月 24
1741
Error message 已解决
2
11月 23
2630
1
3月 24
1973