What modules come builtin with your Python? Let's exclude the internal _ starting ones for this question. You know those? Are you sure? Good, because I did not!

(Hint WindowsXP and Python2.72 has 27 builtin modules)

Here the answer in code

import sys
print('\n'.join(n for n in sys.builtin_module_names if not n.startswith('_')))

help(module_name) could be handy after this. Or looking from builtin help. I sure was curious to check the audioop.

Recommended Answers

All 2 Replies

What modules come builtin with your Python? Let's exclude the internal _ starting ones for this question. You know those? Are you sure? Good, because I did not!

(Hint WindowsXP and Python2.72 has 27 builtin modules)

Here the answer in code

import sys
print('\n'.join(n for n in sys.builtin_module_names if not n.startswith('_')))

help(module_name) could be handy after this. Or looking from builtin help. I sure was curious to check the audioop.

Sorry, they are 29 for Python 2.72.

import sys
print('\n'.join('%i: %s' % (ind, n)
                for ind, n in enumerate(
                    (s for s in sys.builtin_module_names
                     if not s.startswith('_')), 1)
                )
      )

An alternative way to explore your modules is to start a pydoc server and visit it with your web browser. Here is how it goes in linux

$ pydoc -p 9999&
[1] 7877
$ pydoc server ready at http://localhost:9999/

It shows hundreds of modules for me to explore :)

Note that pydoc has a limitation: it must import a module first to show the module's doc. This could be annoying for certain modules.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.