暂时只能找python的代码吼吼
看来还有很长的路要走
import easygui as g,sys,os
list1=[]
def seach_file(path):#OK
os.chdir(path)
for each_file in os.listdir():
if os.path.splitext(each_file)[1]=='.py':
list1.append(os.getcwd()+'\\'+each_file)
elif os.path.isdir(each_file):
seach_file(each_file)
os.chdir(os.pardir)
def print_all(x,y,jd):
a='您目前写了%s行代码,完成进度%s\n'%(str(y),str(jd))+'离10万行代码还差%s,加油啊啊啊啊啊!'%(str(1e6-y))
msg='【.py】源文件%s个,源代码%s行'%(str(x),str(y))
g.textbox(msg=a,title='统计结果',text=msg)
def main():
path=g.diropenbox('请选择主目录')
seach_file(path)
count=0
n=0
for each_file in list1:
n+=1#文件数
with open(each_file,encoding='UTF-8') as f:
for line in f.readlines():
count+=1#总行数
jd=(count/1e6)*100
jd=str(jd)+'%'
print_all(n,count,jd)
main()