Passa al contenuto
Menu
È necessario essere registrati per interagire con la community.
La domanda è stata contrassegnata
1 Rispondi
4211 Visualizzazioni

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
Abbandona
Risposta migliore

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
Abbandona
Post correlati Risposte Visualizzazioni Attività
1
set 24
3074
1
apr 24
1635
2
gen 24
1735
2
nov 23
2608
1
mar 24
1965