class myException(Exception):
    
    def __init__(self,error,msg):
        self.args = (error,msg)
        self.error = error
        self.msg = msg

try:
    raise myException(1,'my exception')
except Exception as e:
    print str(e)

简单的自定义异常

相关文章:

  • 2021-12-09
猜你喜欢
  • 2022-02-10
  • 2022-01-16
  • 2022-01-16
  • 2022-12-23
  • 2021-09-26
  • 2021-09-11
  • 2022-01-09
相关资源
相似解决方案