文章目录
class hexinException(BaseException):
def __init__(self,msg):
self.msg=msg
def __str__(self):
return self.msg
try:
raise hexinException('类型错误')
except hexinException as e:
print(e)
输出
类型错误
class hexinException(BaseException):
def __init__(self,msg):
self.msg=msg
def __str__(self):
return self.msg
try:
raise hexinException('类型错误')
except hexinException as e:
print(e)
输出
类型错误