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