用户:锦廷查看:0 回复:0 评论:0 创建时间:2022-08-20T10:17:28
【作品展示】

【作品介绍】
异常的最终章
【作品源代码】
#自定义异常类
#class 异常类名(Exception):
# def __init__(self,message)
# super().__init__(message)
class MrLinsError(Exception):
def __init__(self,message)
super().__init__(message)
try:
a=int(input())
b=int(input())
c=a/b
print(c)
except ZeroDivisionError as ZeroDivisionError:
raise MrLinsError('Error')
except ValueError as ValueError:
raise MrLinsError('Error')
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn