Output exception arguments, string representation of exception,and the traceback,,import trace
文章由Byrx.net分享于2019-03-23 07:03:21
Output exception arguments, string representation of exception,and the traceback,,import trace
import tracebackdef function1(): function2()def function2(): function3()def function3(): try: raise Exception, 'An exception has occurred' except Exception: print 'Caught exception in function3. Reraising....\n' raisetry: function1()except Exception, exception: print 'Exception caught in main program.' print '\nException arguments:', exception.args print '\nException message:', exception print '\nTraceback:' traceback.print_exc()
相关内容
- Recursive definition of function factorial,recursivefactorial,def f
- type function used for class,functionused,class Classi
- Strings translate,stringstranslate,s = raw_inpu
- Module scope variables,scopevariables,//moda.pyX =
- DBM Demo,dbmdemo,import sys,
- Check that all '.pyc' files exist and are up-to-date,
- python list枚举enumerate,pythonenumerate,""" enume
- Functional Programming Tools: filter,,# 'filter(fu
- Using the and-or Trick,and-ortrick,a = 'first'
- store and fetch data by key,storefetch,import anydb
评论关闭