How can I check if an object has an attribute?

How do I check if an object has some attribute? For example:

>>> a = SomeClass()
>>> a.property
Traceback (most recent call last):
  File "", line 1, in 
AttributeError: SomeClass instance has no attribute 'property'

How do I tell if a has the attribute property before using it?

← Назад к списку