As the title says, how would I go about converting '1,0' into 1,0
I've been getting ValueError: invalid literal for int() with base 10: '1,0'
Asked
Active
Viewed 1,304 times
1
2 Answers
1
First of all, 1,0
is generally not valid syntax for a float. You have to use 1.0
. Second you can't convert 1.0
to an int, as this is a float. Use float("1.0")
instead. If you need an int you can round
the parsed float, e.g.
round(float("1.0"))

Erich
- 1,838
- 16
- 20