I have a package structure like this:
A/__init__.py
|
--B/__init__.py
|
--C/__init__.py
In each package and sub packages, it contains a few classes, e.g. A/__init__.py
contains class A1 and A2, B/__init__.py
contains class B1 and B2, C/__init__.py
contains class C1 and C2. In A/__init__.py
, it adds all the class names of A and its sub packages into __all__
.
Now, I want to print out all package names as well as their contained class names, e.g.
A contains A1, A2, B contains B1, B2, C contains C1, C2
So given the absolute path of package A, e.g. 'xx/yy/A', how can I print the above line?
My question is not about how to retrieve file path of a package.