How to View the List of Functions in a Python Module
After importing a module into a Python script, you need to know the list of available functions to use them effectively. Remembering all of them is impossible, which can be a real time-waster for programmers.
Fortunately, Python provides an easy way to view the list of all functions contained in a module through its built-in help. The process is straightforward.
Viewing the List of Functions in a Module
Simply type the name of the module followed by a dot.
Then, wait a few seconds without pressing enter.
A list of all the functions within the module should appear.
This allows you to find the function you need without having to search through the module's documentation.
Selecting a Function
Navigate through the list using the arrow keys on your keyboard.
Once you find the function you are interested in, select it and press enter.
The function will then appear in the command line of your console or editor.
However, you still need to understand the parameters that the function requires.
Identifying the Function's Parameters
To see the list of parameters for a function, open a parenthesis after the function name.
After a few seconds, the online help will display the list of parameters.
Note: In this example, the atan() function has only one input parameter, a numerical value x.
Now, enter the function's parameters and close the parenthesis. Then press enter.
If you are using the Python interpreter console, the result of the function will be displayed immediately.
If you are using a script editor (like IDLE), you can be confident that you have written the function with the correct syntax.
This method allows you to use the functions in Python modules without needing to memorize them all.