摘要:
#coding=utf-8#---异常处理---# 写一个自己定义的异常类class MyInputException(Exception): def __init__(self, length, least): Exception.__init__(self) self.length = length self.least = leasttry: s = raw_input(u'输入一个字符串:') # 如果长度小于5,触发自定义的异常 if len(s) < 5: raise MyInputException(... 阅读全文