简单的统计代码程序

感情迁移 提交于 2020-03-06 00:06:31
# -*- coding: utf-8 -*-

import os,re

num = 0
for root, dis, files in os.walk('G:\\paopaoyu\\apps'):
    for fil in files:
        p = re.compile('\W*.py$')
        m = p.search(fil)
        if m:
            #print fil
            f = file(root + '\\' + fil)
            temp = 0
            while True:
                line = f.readline()
                if len(line) == 0:
                    break
                num += 1
                temp += 1
            print fil + '----' + str(temp)
            f.close()
print num

  

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!