标签:exception input 自定义 pytho print pre tin cep ini
class ShortInputException(Exception):
def __init__(self, msg):
self.msg = msg
def __str__(self):
return str(self.msg)
try:
print(‘zz‘)
raise ShortInputException(‘短了。。。‘)
except Exception as e:
print(e)
代码如上所示:
标签:exception input 自定义 pytho print pre tin cep ini
原文地址:https://www.cnblogs.com/linwenbin/p/11815426.html