theta
theta

Reputation: 25631

List standard Python library moduled and appropriate submodules?

Is there, hopefully, an easy way to list Python standard library modules and class submodules?

I read this question but it's not working for me, not because it lists all available modules (can be tweaked to avoid, I know) but it does not include submodules. Like for example it lists module urllib but without submodule classes:

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

So is there some other way?

Upvotes: 2

Views: 321

Answers (1)

Raymond Hettinger
Raymond Hettinger

Reputation: 226624

To drill into submodules use the inspect and pyclbr modules. Those are the same support tools used by pydoc, help, and sphinx.

Good luck with your tooltip maker.

Upvotes: 1

Related Questions