by reference to this post: ValueError: could not convert string to float on heroku
Others suggesting when converting string to int you have to convert it to float first and then use int()
However, it doesn't work for me and I don't know why.
Here is the code and the error message
a = '6,011'
print(int(float(a)))
ValueError: could not convert string to float: '6,011'
a = '6,011'
print(int(a))
ValueError: invalid literal for int() with base 10: '6,011'
replace()function.floatfirst is if the number has a decimal point. Some cultures use.as a decimal point and,as a thousands separator; others work the other way around.