用代码描述如何定义异常类、抛出异常类以及捕捉异常类
class MyException(Exception):
pass
num = 12
try:
if num >= 10:
raise MyException('抛出异常')
print('正常执行代码')
except MyException:
print('发生了异常')
标签:自定义,067,抛出,MyException,num,print,异常,代码
来源: https://www.cnblogs.com/yuminhu/p/16058351.html