How can I discover what functions are available from a module?

Question

How can I discover what functions are available from a module?

Answer

The best way to see the functions available from a module is to Google the module name and look over the documentation for the specific function you’re curious about. This will not only give you an idea of what you can do with a module, but also how you can use the functions.
For example, Googling “python math module functions” leads us to this page, which has everything we need to know about the module!
Third party modules that don’t come built into Python aren’t guaranteed to have documentation, though, so you may eventually need to ask for help on sites like StackOverflow.

4 Likes

You can use this to see the same list as the exercise except every functions is on its own line.

import math # Imports the math module

mod = “math”

for i in range(0,len(dir(mod))):
print dir(mod)[i]

1 Like

import math # Imports the math module

mod = dir(math)

for i in range(0,len(mod)):
print mod[i]