python except exception e code example
Example 1: python exception
try:
# code block
except ValueError as ve:
print(ve)
Example 2: python catch any exception
try:
do_something()
except:
print "Caught it!"
try:
# code block
except ValueError as ve:
print(ve)
try:
do_something()
except:
print "Caught it!"