Answer the question
In order to leave comments, you need to log in
What is an attribute in Python?
The dir(object) method lists the object's attributes. And the list has object methods. Why?
Answer the question
In order to leave comments, you need to log in
Attributes are all properties of an object, in fact - all variables defined inside the object and its parents. They are all entered into the object's dictionary and returned by the dir.
Want without methods -
list(filter(lambda attr: not callable(getattr(obj, attr)), dir(obj)))
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question