I have a number of type string with single quotes. e,g
var = '2,000'
type(var) # <class 'str'>
I want to convert it to int.
I have tried int(var)
But it gives an error
invalid literal for int() with base 10: '2,000'
If your number contains ',' then you should use this.
> var = '2,000'
> int(a.replace(',', ''))
> 2000
else this
> var = '2000'
> i = int(var)