Skip to Content
Menú
This question has been flagged
1 Respondre
4242 Vistes

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
Descartar
Best Answer

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
Descartar
Related Posts Respostes Vistes Activitat
1
de set. 24
3111
1
d’abr. 24
1663
2
de gen. 24
1749
2
de nov. 23
2641
1
de març 24
1982