When we don’t know about what the kind of error that throwed by try: … except: .., we can just print out the message by:
1 | except Exception, e: |
And get the error from “message” attribute of “e”. For instance:
1 2 3 4 5 6 | a = [] try: a[100] except Exception, e: print e.message |