Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import os
- rdirs = {"D:/disk/Users/Mike/Documents", "D:/disk/Documents"}
- exts = {}
- for rootdir in rdirs:
- for subdir, dirs, files in os.walk(rootdir):
- for file in files:
- ext = os.path.splitext(file)[1]
- if (ext in exts):
- exts[ext] += 1
- else:
- exts[ext] = 1
- fn = {".cpp", ".py", ".java", ".c", ".pas"}
- res = 0
- for ext in fn:
- if (ext in exts):
- res += exts[ext]
- print(ext + ":", exts[ext])
- print("---------")
- print(res)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement