Get available modules Get available modules python python

Get available modules


Type help() in the interpreter

then

To get a list of available modules, keywords, or topics, type "modules","keywords", or "topics".  Each module also comes with a one-line summaryof what it does; to list the modules whose summaries contain a given wordsuch as "spam", type "modules spam".                                     help> modules 


If you use ipython, which is an improved interactive Python shell (aka "REPL"), you can type import  (note the space at the end) followed by a press of the [TAB] key to get a list of importable modules.

As noted in this SO post, you will have to reset its hash of modules after installing (certain?) new ones. You likely don't need to worry about this yet.

If you don't use ipython, and you haven't tried it, it might be worth checking out. It's a lot better than the basic Python shell, or pretty much any other REPL I've used.

ipython Installation

If you're running linux, there is most likely an ipython package that you can install through your system management tools. Others will want to follow these instructions.

If your installation route requires you to use easy_install, you may want to consider instead using pip. pip is a bit smarter than easy_install and does a better job of keeping track of file locations. This is very helpful if you end up wanting to uninstall ipython.

Listing packages

Note that the above tip only lists modules. For a list which also includes packages —which contain modules— you can do from  + [TAB]. An explanation of the difference between packages and modules can be found in the Modules chapter of the helpful official Python tutorial.

#rtfm

As an added note, if you are very new to python, your time may be better spent browsing the standard library documentation than by just selecting modules based on their name. Python's core documentation is well-written and well-organized. The organizational groups —File and Directory Access, Data Types, etc.— used in the library documentation's table of contents are not readily apparent from the module/package names, and are not really used elsewhere, but serve as a valuable learning aid.


This was very useful. Here is a script version of this:

# To list all installed packages just execfile THIS file# execfile('list_all_pkgs.py')for dist in __import__('pkg_resources').working_set:   print dist.project_name.replace('Python', '')