I looked through your error message, and that explained why you were getting the error.
You're doing print(int(price))
, and from your error it's visible that you aren't converting float
to int
, you are converting a str
to int
. Normally, even this should work, but your str
has a ,
.
There are already answers for questions like these, and this is a good one.
You will have to change the code from the above answer to match your locale, so that it converts based on the monetary/currency system you are using.
Now, if you're sure that you simply want to ignore all commas (,
), you can use int(float(price.replace(',','')))
.