python 自定义错误处理
2021-01-16 16:13
阅读:785
            
                         标签:自定义异常   turn   ISE   类型   code   简单   style   col   exception      python 自定义错误处理 标签:自定义异常   turn   ISE   类型   code   简单   style   col   exception    原文地址:https://www.cnblogs.com/zjj1990/p/12924649.html简单的自定义异常处理
class CustomizeError(BaseException):
    def __init__(self, msg):
        self.msg = msg
    def __str__(self):
        return self.msg
try:
    raise CustomizeError(‘错误类型‘)
except CustomizeError as e:
    print(e)
评论
亲,登录后才可以留言!