Course
Simulator
More
Premium
Log in
Python Function Reference
Functions
hasattr
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