Monday, July 23, 2012

Python: try except generic exception

   try:
       myInt = int ("100000A") # throws exception
       #myInt = int ("100000") # doesn't throw exception
       print "myInt:" , myInt
   except Exception, e:
       print "My Error: " , str(e)

Resource:
http://www.daniweb.com/software-development/python/threads/169976/python-try...except-printing-exception

No comments: