【python】python 类内函数调用方式

一般是类.方法或者是继承(本次不说继承)
class A(object):
def f1(self):
print(“输出5”)
class B(object):
def f1(self):
print(“输出3”)
A.f1(self)
T = B()
T.f1()

或者:
class A(object):
def f1(self):
print(“输出5”)
class B(object):
def __init__(self):
self.a = A()
def f1(self):
print(“输出3”)
self.a.f1()
T = B()
T.f1()

原文地址:https://www.cnblogs.com/fendoudemangguoailiulian/p/11303452.html