python自定义异常

来源:互联网 发布:蒸汽巴士推荐的淘宝店 编辑:程序博客网 时间:2024/05/30 04:34
class  MyException(Exception):       def __int__(self,err):          self.err=errtry:      user=raw_input('Name').strip()       if user!='user':          raise MyException(user)except MyException,e:       print 'not found',                            

1 0
原创粉丝点击