📅  最后修改于: 2022-03-11 14:45:20.767000             🧑  作者: Mango
class Student:
name = 'John'
age = 23
student = Student()
print('Does student has name?: ', hasattr(student, 'name'))
print('Does student has marks?: ', hasattr(student, 'marks'))
# Output:
# Does student has name?: True
# Does student has marks?: False