package com.syl.demo.test; import java.io.*; /** * java代码行数统计工具类 * Created by 孙义朗 on 2017/11/17 0017. */ public class CountCodeLineUtil { private static int normalLines = 0; //有效程序行数 private static int whiteLines = 0; //空白行数 private static int commen…
代码统计 修改filename为文件夹or文件地址,然后统计所有python文件代码 import os import sys def count_code_lines(filename): res = os.walk(filename) count = 0 for path, _, file_list in res: for file in file_list: filename = os.path.join(path, file) if filename.endswith('py'): wi…