I am using Python 2.7. I need to replace "0"
string at the end.
Say, a = "2.50":
a = a.replace('0', '')
I get a = 2.5, and I am fine with this result.
Now a = "200":
a = a.replace('0', '')
I get a = 2, and this output is as per design I agreed. But I expect the output a = 200.
Actually what I am looking is
when any value after decimal point at the end is
"0"
replace that"0"
with None value.
Below are the examples and I am expecting results.
IN: a = "200"
Out: a = 200
In: a = "150"
Out: a = 150
In: a = 2.50
Out: a = 2.5
In: a = "1500"
Out: a = 1500
In: a = "1500.80"
Out: a = 1500.8
In: a = "1000.50"
Out: a = 1000.5
Not a value is string.
Note: sometimes a = 100LL
or a = 100.50mt
.