PyMrLineCounter

View Code
 1 import sys,os
 2 
 3 def LineCounter(i_path):
 4     res=0
 5     f=open(i_path)
 6     for lines in f:
 7         res+=1
 8     return res
 9 
10 if(__name__=='__main__'):
11     allinall=0
12     for root, dirs, files in os.walk('ACM-ICPC'):
13         for item in files:
14             ext=item.split('.')
15             ext=ext[-1]
16             if(ext in ['cc','java','cpp','c','py','cxx']):
17                 path=root+'/'+item
18                 allinall+=LineCounter(path)
19     print "Total lines of your code :",allinall

posted on 2012-05-16 14:02  Wizmann  阅读(140)  评论(0)    收藏  举报

导航