Skip to content

Latest commit

 

History

History
29 lines (20 loc) · 400 Bytes

File metadata and controls

29 lines (20 loc) · 400 Bytes

ValueError: could not convert string to float

Occurs when converting a non-numeric string to float.

Reproduce

value = "abc"
number = float(value)
print(number)

Error Message

ValueError: could not convert string to float: 'abc'

Fix

value = "3.14"
number = float(value)
print(number)

Reflection

Tried converting a string that wasn't a number.