Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You could use <a href="http://docs.python.org/library/pkgutil.html#module-pkgutil" rel="nofollow noreferrer">pkgutil</a>. This lists all modules inside /usr/lib/python2.6/site-packages: (Unlike <code>sys.modules</code>, this lists modules without you having to import them first).</p> <pre><code>import pkgutil print [name for module_loader,name,ispkg in pkgutil.walk_packages(['/usr/lib/python2.6/site-packages'])] </code></pre> <p><strong>Edit</strong>: <a href="http://docs.python.org/library/pkgutil.html#module-pkgutil" rel="nofollow noreferrer">The docs</a> do not list <code>walk_packages</code>. However, <code>pkgutil</code> includes <code>walk_packages</code> in <code>pkgutil.__all__</code>. This means it is part of pkgutil's public interface. You can find the following documentation on <code>walk_packages</code> in /usr/lib/python2.6/pkgutil.py or by typing <code>help(pkgutil.walk_packages)</code>:</p> <pre><code>Definition: pkgutil.walk_packages(path=None, prefix='', onerror=None) Docstring: Yields (module_loader, name, ispkg) for all modules recursively on path, or, if path is None, all accessible modules. 'path' should be either None or a list of paths to look for modules in. 'prefix' is a string to output on the front of every module name on output. Note that this function must import all *packages* (NOT all modules!) on the given path, in order to access the __path__ attribute to find submodules. 'onerror' is a function which gets called with one argument (the name of the package which was being imported) if any exception occurs while trying to import a package. If no onerror function is supplied, ImportErrors are caught and ignored, while all other exceptions are propagated, terminating the search. Examples: # list all modules python can access walk_packages() # list all submodules of ctypes walk_packages(ctypes.__path__, ctypes.__name__+'.') </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload