title: Python counting file extensions
body: <p>I am trying to print the file extension in a certain directory and the count of each extension.</p>
  
  <p>This is what I have so far...</p>
  
  <pre><code>import os 
  import glob
  
  os.chdir(r"C:\Python32\test")
  x = glob.glob("*.*")
  for i x:
      print(i)
  
  &gt;&gt;&gt; file1.py
      file2.py
      file3.py
      file4.docx
      file5.csv
  </code></pre>
  
  <p>So I am stuck, I need my overall output to be...</p>
  
  <pre><code>py    3
  docx  1
  csv   1
  </code></pre>
  
  <p>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.</p>
  
  <p>Thanks for the help.</p>