class aa: def __init__(self): self.a = 'a' class bb(aa): def __init__(self): self.b = 'b' super(bb, self).__init__() print(self.a) obj = bb()
class foo: def __init__(self): self.bb = 'bb' def fun_a(self,aaa): self.cc = aaa print('123') class Foo(foo): def fun_b(self): self.fun_a('ddddd') print(self.cc) obj = Foo() obj.fun_b()
class foo: def __init__(self): self.name = 'lll' def __str__(self): return self.name obj = foo() print(obj)
class foo: def __init__(self): pass class ms: bb = '初八' def __str__(self): return foo.ms.bb obj = foo() print(obj)