2011-10-23 52 views
1

希望有一种简单的方法来列出Python标准库模块和类子模块吗?列表标准Python库模块化和适当的子模块?

我看过this问题,但它不适合我,不是因为它列出了所有可用的模块(可以调整以避免,我知道),但它不包括子模块。例如像它列出模块的urllib但无子模块类:

urllib.ContentTooShortError  urllib.main      urllib.splituser 
urllib.FancyURLopener   urllib.noheaders     urllib.splitvalue 
urllib.MAXFTPCACHE    urllib.os      urllib.ssl 
urllib.URLopener     urllib.pathname2url    urllib.string 
urllib.addbase     urllib.proxy_bypass    urllib.sys 
urllib.addclosehook    urllib.proxy_bypass_environment urllib.test 
urllib.addinfo     urllib.quote      urllib.test1 
urllib.addinfourl    urllib.quote_plus    urllib.thishost 
urllib.always_safe    urllib.reporthook    urllib.time 
urllib.basejoin     urllib.socket     urllib.toBytes 
urllib.c       urllib.splitattr     urllib.unquote 
urllib.ftpcache     urllib.splithost     urllib.unquote_plus 
urllib.ftperrors     urllib.splitnport    urllib.unwrap 
urllib.ftpwrapper    urllib.splitpasswd    urllib.url2pathname 
urllib.getproxies    urllib.splitport     urllib.urlcleanup 
urllib.getproxies_environment urllib.splitquery    urllib.urlencode 
urllib.i       urllib.splittag     urllib.urlopen 
urllib.localhost     urllib.splittype     urllib.urlretrieve 

那么,有一些其他的方式?

+1

http://stackoverflow.com/questions/1707709/list-all-the-modules-that-are-part-of-a-python-package – dierre

+0

所以,你建议我使用我的链接问题列出声压级模块然后使用'pkgutil'打印子模块?如果那样的话,有没有其他方法可以导入整个Python库?谢谢 – theta

+0

你为什么需要这个? –

回答

1

要钻入子模块,请使用inspectpyclbr模块。这些是pydoc,help和sphinx使用的支持工具。

与您的工具提示制造商祝你好运。

+0

所以它可能没有导入整个图书馆!谢谢 – theta