pfm8qg
Last Updated: January 27, 2017
·
5.691K
· purak
Fe0a1519fcf6d2efd7f1a0bbc20660d2

Counting lines of code in a Python project

Today, I need a shell trick to count lines of code in a Python project. Of course, you can change *.py expression to count lines of code for a different language.

find . -name "*.py" -type f -exec grep . {} \; | wc -l

I used the above command set in my project root.

Say Thanks
Respond

2 Responses
Add your response

13355
Cc54ae5944af5810788795c32ebc815b

Or use a tool intended for this purpose like cloc (http://cloc.sourceforge.net/)

over 1 year ago ·
13356
Fe0a1519fcf6d2efd7f1a0bbc20660d2

Thanks! It looks nice, I will try.

over 1 year ago ·
Filed Under