doc:: 内置函数 getattr() 获取对象的属性值 语法:getattr(object, attribute, default) 1class Person:2 def __init__(self, name:str):3 self.name = name4 def get(self):5 print(f"Hello {self.name}")6 7person = Person("immwind")8 9print(getattr(person, "name"))10 11get = getattr(person, "get")12get()