class show_Error(Exception):
def __init_(self, leng1):
self.leng1=leng1
try:
s=input("changdu:")
if len(s)>5:
raise show_Error(s)
except show_Error as result:
print(result.leng1)
print("error")
输入大于5的字符串,为什么报错AttributeError: 'show_Error' object has no attribute 'leng1',except show_Error as result:这一行怎么理解;不是指向show_Error(s)这个实例吗
求大神指导
def __init_(self, leng1):
self.leng1=leng1
try:
s=input("changdu:")
if len(s)>5:
raise show_Error(s)
except show_Error as result:
print(result.leng1)
print("error")
输入大于5的字符串,为什么报错AttributeError: 'show_Error' object has no attribute 'leng1',except show_Error as result:这一行怎么理解;不是指向show_Error(s)这个实例吗
求大神指导
