I have a string as follows '$123,456.12'. i want to get rhe value integer value of the string 123456.
I have tried using this function
int(''.join(list(filter(str.isdigit, number))))
but it returns 12345612.
Is there any other solution ?
I have a string as follows '$123,456.12'. i want to get rhe value integer value of the string 123456.
I have tried using this function
int(''.join(list(filter(str.isdigit, number))))
but it returns 12345612.
Is there any other solution ?
data = '$123,456.12'
print (int(''.join(list(filter(str.isdigit, data.split('.')[0])))))
# or
print (int(''.join(i for i in data.split('.')[0] if i.isdigit())))
output:
123456
x = '$123,456.12'
end = x.index('.')
int(x[1:end].replace(',', ''))