import os
count=0
for root,dirs,files in os.walk("C:\python\Lib"):
for file_name in files:
if file_name[-3:]==".py":
file_path=os.path.join(root,file_name)
with open(file_path,"rb") as fp:
for line in fp:
count+=1
The sum of the number of lines of all python files in the python statistics folder
Guess you like
Origin blog.csdn.net/weixin_44123630/article/details/111597844
Recommended
Ranking