Module list generation

D

Doug Kearns

Is this the best/simplest way to generate a module list?

python -c 'from pydoc import help; help("modules")'

Thanks,
Doug
 
S

Scott David Daniels

Doug said:
Is this the best/simplest way to generate a module list?

python -c 'from pydoc import help; help("modules")'

Thanks,
Doug
I am not sure if this is what you want, but how about:

For python 2.4, try:
python -c "import sys; print sorted(sys.modules)"

For earlier pythons, use:
python -c "import sys; nms = sys.modules.keys(); nms.sort(); print nms"
or:
python -c "import sys; print sys.modules.keys()"
if you don't care about order.

--Scott David Daniels
(e-mail address removed)
 
D

Doug Kearns

I am not sure if this is what you want, but how about:

I'm updating the zsh completion function for python and need to
generate a list of modules for completing the new '-m' option.
For python 2.4, try:
python -c "import sys; print sorted(sys.modules)"

I don't know python, but as I understand it, this only lists _loaded_
modules.

Thanks,
Doug
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,212
Messages
2,571,102
Members
47,698
Latest member
TerraT521

Latest Threads

Top