【Python】Python类中函数之间调用变量

class A(object):
    def __init__(self, ff):
        self.ff = ff
        pass

    def _a(self, m):
        m.append(3)
    
    def _b(self):
        mat = []
        self._a(mat)
        print(mat)

t = A(1)
t._b()

输出是:[3]

你可能感兴趣的:(Python,python)