一.继承 class Animal(object): def run(self): print('Animal is running...') class Dog(Animal): def run(self): print('Dog is running...') def eat(self): print('Eating meat...') dog = Dog() dog.run() Dog is running... 当子类和父类都存在相同的run()方法时,我们说,子类的run()覆盖了父类…
####################总结########## 1. isinstance: 判断xxx是否是xxx类型的(向上判断) type: 返回xx对象的数据类型 issubclass: 判断xxx类是否是xxx类的子类 type: 返回xx对象的数据类型 def add(a, b): if (type(a) == int or type(a) == float) and (type(b) == int or type(b) == float): return a + b else:…