Skip to Content
Menu
Dette spørgsmål er blevet anmeldt
1 Svar
4238 Visninger

Hallo,

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

Thanks

Avatar
Kassér
Bedste svar

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

Avatar
Kassér
Related Posts Besvarelser Visninger Aktivitet
1
sep. 24
3105
1
apr. 24
1656
2
jan. 24
1748
2
nov. 23
2639
1
mar. 24
1979