Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
55
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.47 KB | None | 0 0
  1. import os
  2.  
  3.  
  4. out = 0
  5.  
  6.  
  7. def list_dir(path):
  8.     ignore = [
  9.         '.idea',
  10.         '.git'
  11.     ]
  12.     for file in os.listdir(path):
  13.         full_path = os.path.join(path, file)
  14.         if os.path.isdir(full_path):
  15.             if file not in ignore:
  16.                 list_dir(full_path)
  17.         else:
  18.             global out
  19.             out += len(open(full_path, errors='ignore').readlines())
  20.  
  21. if __name__ == '__main__':
  22.     list_dir(os.getcwd())
  23.     print(out)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement