counting lines of code

Ben Finney ben+python at benfinney.id.au
Thu Jan 21 02:12:06 EST 2010


Michele Simionato <michele.simionato at gmail.com> writes:

> I need a small utility to count the lines of Python code in a
> directory, traversing subdirectories and ignoring comments and
> docstrings. I am sure there is already something doing that, what do
> you suggest?

Any of the static code checkers (‘pylint’, ‘pyflakes’, etc.) would
already be doing this.

You would at least be able to crib from them, maybe import the
functionality; ideally they can directly report what you want to see.

-- 
 \       “My business is to teach my aspirations to conform themselves |
  `\              to fact, not to try and make facts harmonise with my |
_o__)                   aspirations.“ —Thomas Henry Huxley, 1860-09-23 |
Ben Finney



More information about the Python-list mailing list