Advertisement
Guest User

Untitled

a guest
Jul 23rd, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.36 KB | None | 0 0
  1. import os
  2.  
  3. def lines(path):
  4.     return len(open(path).readlines())
  5.  
  6. total_files = 0
  7. total_lines = 0
  8. for (path, dirs, files) in os.walk("C:/Python26/"):
  9.     python_files = [f for f in files if f.endswith(".py")]
  10.     total_files += len(python_files)
  11.     total_lines += sum([lines(os.path.join(path,f)) for f in python_files])
  12.  
  13. print total_files, total_lines
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement