H
Harlin Seritt
Using the code below:
---BEGIN CODE---
value = raw_input("Type a divisor: ")
try:
value = int(value)
print "42 / %d = %d" % (value, 42/value)
except ValueError:
print "I can't convert the value to an integer"
except ZeroDivisionError:
print "Your value should not be zero"
except:
print "Something unexpected happened"
---END CODE---
In the last 'except' block, how can I print out the particular error
name even though one is not specifically named?
Thanks,
Harlin
---BEGIN CODE---
value = raw_input("Type a divisor: ")
try:
value = int(value)
print "42 / %d = %d" % (value, 42/value)
except ValueError:
print "I can't convert the value to an integer"
except ZeroDivisionError:
print "Your value should not be zero"
except:
print "Something unexpected happened"
---END CODE---
In the last 'except' block, how can I print out the particular error
name even though one is not specifically named?
Thanks,
Harlin