🔌 Toolbox of short, reusable pieces of code and knowledge.
my_obj
).dir
method:
print(dir(my_obj))
Note that this will print out all of the dunder methods as well. To filter those out, use (this snippet was taken from here):
method_list = [method for method in dir(MyClass) if method.startswith('__') is False]
print(method_list)
Alternatively, use the inspect
package:
import inspect
# Store methods in a list
method_list = inspect.getmembers(ClasName, predicate=inspect.ismethod)
print(method_list)
See more here.