I have list of numbers as str
li = ['1', '4', '8.6']
if I use int to convert the result is [1, 4, 8].
If I use float to convert the result is [1.0, 4.0, 8.6]
I want to convert them to [1, 4, 8.6]
I've tried this:
li = [1, 4, 8.6]
intli = list(map(lambda x: int(x),li))
floatli = list(map(lambda x: float(x),li))
print(intli)
print(floatli)
>> [1, 4, 8]
>> [1.0, 4.0, 8.6]
['-5', '-8.3']