How to list all functions in a Python module?

Chris Gow picture Chris Gow · Sep 26, 2008 · Viewed 716.4k times · Source

I have a python module installed on my system and I'd like to be able to see what functions/classes/methods are available in it.

I want to call the doc function on each one. In ruby I can do something like ClassName.methods to get a list of all the methods available on that class. Is there something similar in python?

eg. something like:

from somemodule import foo
print foo.methods # or whatever is the correct method to call

Answer

camflan picture camflan · Sep 26, 2008

You can use dir(module) to see all available methods/attributes. Also check out PyDocs.