Python Function Reference

hasattr
The arguments are an object and a string. The result is True if the string is the name of one of the object's attributes, False if not.
Python 3.13
hasattr(object, name)
object
The object to check.
name
The name of the attribute.
Examples
Python 3.13
>>> hasattr('hello', 'upper')
True