class A: def __init__(self, info ={}): self.info = info def __getattr__(self, item): return self.info[item] a =A() a.age = 123 print(a.age) a.name = 123 print(a.name) a.xis = 123 print(a.xis) print(a.__dict__)
原文地址:https://www.cnblogs.com/7134g/p/11536014.html
时间: 2024-11-09 00:56:58