pytest常见的异常处理方法

具体内容需要二次学习,课程里面只提及两种处理方式。

 

 

 try except例子:

try:
a = int(input())
b = int(input())
c = a/b
except ZeroDivisionError as e:
print("cannot be zero")
posted @ 2022-05-10 10:17  lms21  阅读(169)  评论(0)    收藏  举报