class Fu:
def __init__(self,name=None,age=None):
self.name="maotai"
self.age=22
f = Fu()
for line in f.__dict__:
print(line)
name
age
class Fu:
def __init__(self,name=None,age=None):
self.name="maotai"
self.age=22
class Zi:
def __init__(self):
self.f1 = Fu()
z = Zi()
print( z.__dict__)
for line in z.__dict__:
print(line)
{'f1': <__main__.Fu object at 0x00000000021CC2B0>}
f1