Python Catch All Exceptions

/ Published in: Python
Save to your folder(s)

Copy this code and paste it in your HTML
  1. try:
  2. dosomething()
  3. print "Record Added"
  4. except: # catch *all* exceptions
  5. e = sys.exc_info()[1]
  6. print "Error: %s" % e

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.