版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/cui130/article/details/86408204
文章目录
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)
输出
类型错误