Created
July 31, 2017 10:12
-
-
Save vaibhav-jain/2674a7df50a9918e575bf077d29a0f98 to your computer and use it in GitHub Desktop.
Python to print names of all classes present inside a package. Just add this code to your __init__.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import inspect | |
from pprint import pprint | |
clsmembers = inspect.getmembers(sys.modules[__name__], inspect.isclass) | |
l = list() | |
for k, v in clsmembers: | |
l.append(k) | |
pprint(set(l)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment