Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- def lines(path):
- return len(open(path).readlines())
- total_files = 0
- total_lines = 0
- for (path, dirs, files) in os.walk("C:/Python26/"):
- python_files = [f for f in files if f.endswith(".py")]
- total_files += len(python_files)
- total_lines += sum([lines(os.path.join(path,f)) for f in python_files])
- print total_files, total_lines
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement