Re: Function for examine content of directory

2012-09-07 Thread Tigerstyle
Ok I'm now totally stuck. This is the code: --- import os from collections import Counter path = ":c\\mypath\dir" dirs = os.listdir( path ) filenames = {"this.txt", "that.txt", "the_other.txt","this.doc","that.doc","this.pdf","first.txt","that.pdf"} extensions = [] for filename in filenames:

Re: Function for examine content of directory

2012-09-07 Thread Tigerstyle
kl. 16:56:29 UTC+2 torsdag 6. september 2012 skrev Tigerstyle følgende: > Hi guys, > > > > I'm trying to write a module containing a function to examine the contents of > the current working directory and print out a count of how many files have > each extension (".txt", ".doc", etc.) > > >

Re: Function for examine content of directory

2012-09-06 Thread Chris Angelico
On Fri, Sep 7, 2012 at 12:56 AM, Tigerstyle wrote: > I'm trying to write a module containing a function to examine the contents of > the current working directory and print out a count of how many files have > each extension (".txt", ".doc", etc.) If you haven't already, look into the Python 'd

Re: Function for examine content of directory

2012-09-06 Thread Tigerstyle
Thanks, just what I was looking for :-) T kl. 17:20:27 UTC+2 torsdag 6. september 2012 skrev MRAB følgende: > On 06/09/2012 15:56, Tigerstyle wrote: > > > Hi guys, > > > > > > I'm trying to write a module containing a function to examine the contents > > of the current working directory and p

Re: Function for examine content of directory

2012-09-06 Thread MRAB
On 06/09/2012 15:56, Tigerstyle wrote: Hi guys, I'm trying to write a module containing a function to examine the contents of the current working directory and print out a count of how many files have each extension (".txt", ".doc", etc.) This is the code so far: -- import os path = "v:\\wor

Re: Function for examine content of directory

2012-09-06 Thread Ian Foote
On 06/09/12 15:56, Tigerstyle wrote: Hi guys, I'm trying to write a module containing a function to examine the contents of the current working directory and print out a count of how many files have each extension (".txt", ".doc", etc.) This is the code so far: -- import os path = "v:\\wo

Function for examine content of directory

2012-09-06 Thread Tigerstyle
Hi guys, I'm trying to write a module containing a function to examine the contents of the current working directory and print out a count of how many files have each extension (".txt", ".doc", etc.) This is the code so far: -- import os path = "v:\\workspace\\Python2_Homework03\\src\\" dirs