Is it possible to safely check if a class object has a certain attribute0

Is it possible to safely check if a class object has a certain attribute0
A . yes, by using the hasattr attribute
B . yes. by using the hasattr () method
C . yes, by using the hasattr () function
D . no, it is not possible

Answer: B

Explanation:

Reference: https://stackoverflow.com/questions/610883/how-to-know-if-an-object-has-an-attribute-in-python

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments