统计 某个目录下 所有的文件的行数
import os
#这里的统计没去区分每行的特性,可以根据每人的需要进行修改,并且也确实有修改的必要
def get_file_lines(file_name):
count = -1
for count,line in enumerate(open(file_name,r'r')):
pass
count += 1
return count
def get_model_lines(model_name):
all_num = 0
for root,dirs,files in os.walk(model_name):
for file_name in files:
now_file = os.path.join(root,file_name)
file_lines = get_file_lines(now_file)
all_num += file_lines
return all_num
curdir = r'./cc'
if __name__ == '__main__':
print get_model_lines(r'./cc')
print 18*4