📅  最后修改于: 2022-03-11 14:46:29.375000             🧑  作者: Mango
class Student:
name = 'John'
age = 24
student = Student()
print('Student name: ', getattr(student, 'name'))
print('Student age: ', getattr(student, 'age'))
# Output
# Student name: John
# Student age: 24