1、编写一个自定义异常类StringLengthException,当输入字符串长度超过5,则抛出这个自定义异常对象。
class StringLengthException(Exception):
def __init__(self,length):
super(Exception,self).__init__()
self.length
1、编写一个自定义异常类StringLengthException,当输入字符串长度超过5,则抛出这个自定义异常对象。
class StringLengthException(Exception):
def __init__(self,length):
super(Exception,self).__init__()
self.length