I am trying to print the file extension in a certain directory and the count of each extension.
This is what I have so far...
import os
import glob
os.chdir(r"C:\Python32\test")
x = glob.glob("*.*")
for i x:
print(i)
>>> file1.py
file2.py
file3.py
file4.docx
file5.csv
So I am stuck, I need my overall output to be...
py 3
docx 1
csv 1
I have tried to use something like i.split("."), but I get stuck. I think I need to put the extension in a list and then count the list, but that is where I am running into problems.
Thanks for the help.