标签:span com int try col finally result level sel
//test.py
class myNet(RuntimeError):
def __init__(self,arg):
self.args = arg
def mye(level):
if level<1:
raise Exception(‘123‘, level)
try:
# mye(0)
raise myNet(‘you are welcome!‘)
#except Exception, tup:
# print ‘exception: ‘, tup
except myNet, e:
print ‘myNet‘, ‘args:‘, e
else:
print 2
finally:
print ‘end‘
//result
# python test.py
myNet args: (‘y‘, ‘o‘, ‘u‘, ‘ ‘, ‘a‘, ‘r‘, ‘e‘, ‘ ‘, ‘w‘, ‘e‘, ‘l‘, ‘c‘, ‘o‘, ‘m‘, ‘e‘, ‘!‘)
end
Finally:
当你要用错误处理写程序的时候,要么你玩的很好,要么你在自找麻烦!!!
我说的是目前这个阶段
标签:span com int try col finally result level sel
原文地址:http://www.cnblogs.com/woodzcl/p/7804522.html