How to list all functions in a Python module?
You can use dir(module)
to see all available methods/attributes. Also check out PyDocs.
Use the inspect
module:
from inspect import getmembers, isfunction
from somemodule import foo
print(getmembers(foo, isfunction))
Also see the pydoc
module, the help()
function in the interactive interpreter and the pydoc
command-line tool which generates the documentation you are after. You can just give them the class you wish to see the documentation of. They can also generate, for instance, HTML output and write it to disk.
Once you've import
ed the module, you can just do:
help(modulename)
... To get the docs on all the functions at once, interactively. Or you can use:
dir(modulename)
... To simply list the names of all the functions and variables defined in the module.