On Saturday, June 8, 2013 11:22:16 PM UTC-7, Carlos Nepomuceno wrote:
Just realized that you've asked for installed packages. Perhaps the following
will do the trick. I don't know why the 'lib-tk' isn't included. Why not?
toplevel_packages = ['%s\\%s'%(ml.path,name)for ml,name,ispkg in
Just realized that you've asked for installed packages. Perhaps the following
will do the trick. I don't know why the 'lib-tk' isn't included. Why not?
toplevel_packages = ['%s\\%s'%(ml.path,name)for ml,name,ispkg in
pkgutil.iter_modules() if ispkg]
print '\n'.join(toplevel_packages)
Date:
Adding : python -c 'help(modules) to the other two suggestions:
#!/usr/bin/env python
import commands, pkgutil, re, sys
print('sys.modules.items()...')
print('\n'.join(sorted([re.findall(from '(.*)',str(v))[0] for k,v in
sys.modules.items() if str(v).find('from')-1])))
Carlos Nepomuceno於 2013年6月9日星期日UTC+8下午1時23分15秒寫道:
print '\n'.join([re.findall(from '(.*)',str(v))[0] for k,v in
sys.modules.items() if str(v).find('from')-1])
Date: Sat, 8 Jun 2013 21:30:48 -0700
Subject: Listing modules from all installed packages
From: jph...@gmail.com
To:
print '\n'.join([re.findall(from '(.*)',str(v))[0] for k,v in
sys.modules.items() if str(v).find('from')-1])
Date: Sat, 8 Jun 2013 21:30:48 -0700
Subject: Listing modules from all installed packages
From: jpha...@gmail.com
To: python-list@python.org
Hi,
I'm trying to write a function