Python 继承例子

Animal.py:

class Animal(object):
    def run(self):
        print 'Animal is running...'


Dog.py:

from   mycompany.web.Animal  import *
class Dog(Animal):
    print 'yy'


a1.py:

from   mycompany.web.Dog  import *
dog = Dog()
dog.run()


C:Python27python.exe C:/Users/TLCB/PycharmProjects/untitled/a1.py
yy
Animal is running..

原文地址:https://www.cnblogs.com/hzcya1995/p/13349604.html