2010-05-09 50 views

回答

0

pkgutil可能會有幫助。

另請參閱this SO question.,這是一個代碼示例表格that question

kaizer.se

import pkgutil 
# this is the package we are inspecting -- for example 'email' from stdlib 
import email 
package = email 
for importer, modname, ispkg in pkgutil.iter_modules(package.__path__): 
    print "Found submodule %s (is a package: %s)" % (modname, ispkg) 

~unutbu

import pkgutil 
for importer, modname, ispkg in pkgutil.walk_packages(path=None, onerror=lambda x: None): 
    print(modname) 
相關問題