【发布时间】:2011-11-27 07:41:26
【问题描述】:
如何计算python项目中包含多个子目录的项目中写入的行数。例如 dir 结构就像
A
\ <*some files here*>\
B
\ <*some files here*>\ ... and so on...
【问题讨论】:
标签: python version-control code-metrics
如何计算python项目中包含多个子目录的项目中写入的行数。例如 dir 结构就像
A
\ <*some files here*>\
B
\ <*some files here*>\ ... and so on...
【问题讨论】:
标签: python version-control code-metrics
您可以在 linux 中使用 find 实用程序。
在命令提示符下:
$ find <project_directory_path> -name '*.py' | xargs wc -l
这将为您提供 project_directory 中所有以 .py 结尾的文件的计数,最后是总数。 (我假设您只想要 .py 文件的数量)
如果你只想要总数而不想要别的,你可以使用:
$ find <project_directory_path> -name '*.py' | xargs wc -l | tail -1
【讨论】: