PHP
·
发表于 5年以前
·
阅读量:8410
>>> class Student():
def __init__(self,id,name):
self.id = id
self.name = name
>>> xiaoming = Student('001','xiaoming')
>>> getattr(xiaoming,'name') # 获取name的属性值
'xiaoming'