문제

I have a directory with many subdirectories with Python source code which correspond to a Python package. I want to count how many classes and root classes (top of hierarchies) are contained in these directories/package. Any easy way to do this?

도움이 되었습니까?

해결책

You don't need to write a Python script for that. From the command line type:

grep -c "^class " *.py

and will return the number of classes in the current directory for each .py file. To find if a class is a top class I'm afraid you will have to import each and query each module.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top