getting list of all available modules

Benjamin Rutt rutt.4 at osu.edu
Mon Jun 20 21:33:06 EDT 2005


I note that the help() function of interactive python can determine
all available modules:

    [rutt at akron ~]$ python
    Python 2.4 (#1, Mar 31 2005, 15:26:02) 
    [GCC 3.2.3 (Debian)] on linux2
    Type "help", "copyright", "credits" or "license" for more information.
    >>> help()

    [...]

    help> modules

    Please wait a moment while I gather a list of all available modules...

    BaseHTTPServer      bisect              linuxaudiodev       shelve
    Bastion             bsddb (package)     locale              shlex
    BicycleRepairMan_Idle cPickle             logging (package)   shutil
    CDROM               cStringIO           macpath             signal
    CGIHTTPServer       calendar            macurl2path         site
    Canvas              cgi                 mailbox             smtpd
    ConfigParser        cgitb               mailcap             smtplib

    [...]

I want to do the same (get all such modules in a python list); how can
I do so?  Or where is the code for the REPL for help() itself so I can
find out myself?

This is to build a code introspection tool BTW.  Thanks,
-- 
Benjamin Rutt



More information about the Python-list mailing list