check if something is an attribute of class python code example
Example 1: python3 check if object has attribute
try:
doStuff(a.property)
except AttributeError:
otherStuff()
Example 2: python hasattribute
hasattr(object, name)
try:
doStuff(a.property)
except AttributeError:
otherStuff()
hasattr(object, name)