phoenix13

导航

 

1. handle exception

import sys

try:
     a=1/1
except Exception, e:
     print "failed", sys.exc_info()[0]
else:
    print "no exception"
finally:
    print "execute final"

2. print exception

try:
    raise Exception("aaa","bbb")
    #a=1/0
except Exception as e :
     print (type(e))
     print(e.args)
     print (e)

 

posted on 2014-09-18 11:51  phoenix13  阅读(352)  评论(0编辑  收藏  举报