Reputation: 423
I want to get every methods of an object. I know about the function dir
but it returns all(method, attr, meta_data).
I tried this:
[x for x in dir(obj) if "_" not in x]
but it does not work correctly.
How can I do it?
Upvotes: 3
Views: 6095
Reputation: 20369
You can filter dir
result
[method for method in dir(obj) if callable(getattr(obj, method))]
Upvotes: 4