I have written Python code which does some calculation. During this it converts string
to float
. However sometimes numeric string value may be empty that time its giving me valueError
. I tried to keep that in try catch block however its going to another exception block as shown below.
try:
float(some value)
except Exception as ValueError:
print(error message)
except Exception as oserror:
print(mesage)
Its going to os error block instead of ValueError
block