class Myexception(Exception): def __init__(self,message): self.message=message def __str__(self): return self.message try: raise Myexception("我错了") except Myexception as e: print(e)
自定义一个异常
猜你喜欢
转载自www.cnblogs.com/yangzhen-ahujhc/p/12304557.html
今日推荐
周排行