Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to explore a package in python

Tags:

python

import pkg
dir(pkg)

such a statement in python won't show all the classes / functions / subpackages in the package pkg because some of them might be loaded just in time.So what is the best way to explore a package in python?

like image 308
Bunny Rabbit Avatar asked Feb 25 '23 21:02

Bunny Rabbit


2 Answers

Have you try pydoc

pydoc package

Is the same as calling the help function but you can do it from the command line, and of course you can browse to a module, class or function level with the dot notation.

like image 79
cyraxjoe Avatar answered Mar 07 '23 02:03

cyraxjoe


You can use help(pkg), or obviously doc if it's available.

like image 26
Vincent Savard Avatar answered Mar 07 '23 02:03

Vincent Savard