摘要:
#coding=utf-8 names = ['a','b'] try: names[3] # except IndexError as e: # print '123214',e # except (KeyError,IndexError) as e: # print 'asdasd',e # except Exception as e: #捕获所有异常,不建议... 阅读全文
摘要:
#coding=utf-8 class Dog(object): def __init__(self,name): self.name = name def eat(self): print '1234' def talk(self): print '678678' d = Dog('xiaobai') #choice = raw_i... 阅读全文
摘要:
#coding=utf-8 class Dog(object): ''' 类的描述 ''' def __init__(self,name): self.name = name self.__food = None @staticmethod #实际上跟类没什么关系,单纯的函数,但是必须通过类名来调用 d... 阅读全文