开发者

counting source code lines in python project

开发者 https://www.devze.com 2023-04-08 22:49 出处:网络
How do I calculate the number of lines written in a project containing multiple sub dirs in a python project. for example a dir structure is like

How do I calculate the number of lines written in a project containing multiple sub dirs in a python project. for example a dir structure is like

A  
 \ <*some files here*>\  
  B  
   \ <*some files here*>\ ... 开发者_JS百科and so on...


You could use the find utility in linux.

On the command prompt:

$ find <project_directory_path> -name '*.py' | xargs wc -l

This will give you the count of all files ending with .py in the project_directory and finally the total. (I am assuming you just want the count of .py files)

If you just want the total and nothing else, you could use:

$ find <project_directory_path> -name '*.py' | xargs wc -l | tail -1
0

精彩评论

暂无评论...
验证码 换一张
取 消