python同时继承多个类且方法相同
class A(object): def getName(self): print("name is A") class B(object): def getName(self): print("name is B") class C(A, B): def __init__(self): print("class is C") c = C() c.getName() class D(B, A): def __init__(self): print("class is D") d = D() d.getName() 执行结果为: "D:\Program Files\python3.6.7\python.exe" D:/pythonWorkspace/untitled1019/test/test1.py class is C name is A class is D name is B Process finished with exit code 0 来源: https://www.cnblogs.com/harryTree/p/11804747.html