J
J. Peng
def safe_float(object):
try:
retval = float(object)
except (ValueError, TypeError), oops:
retval = str(oops)
return retval
x=safe_float([1,2,3,4])
print x
The code above works well.But what's the instance of "oops"? where is it
coming from? I'm totally confused on it.thanks.
try:
retval = float(object)
except (ValueError, TypeError), oops:
retval = str(oops)
return retval
x=safe_float([1,2,3,4])
print x
The code above works well.But what's the instance of "oops"? where is it
coming from? I'm totally confused on it.thanks.