for dirpath, dirnames, files in os.walk(os.getcwd()):
    count = sum(os.path.splitext(f)[-1] in extensions for f in files)
print((dirpath, count))
Counting a group of extensions (images) in a directory in Python