类的嵌套
class F1: def __init__(self): self.name='tom' class F2: def __init__(self,b): self.age=b class F3: def __init__(self,c): self.classes=c f1=F1() f2=F2(f1) f3=F3(f2) print(f3.classes.age.name) #运行结果 tom
类的嵌套
class F1: def __init__(self): self.name='tom' class F2: def __init__(self,b): self.age=b class F3: def __init__(self,c): self.classes=c f1=F1() f2=F2(f1) f3=F3(f2) print(f3.classes.age.name) #运行结果 tom