Function for examine content of directory

Chris Angelico rosuav at gmail.com
Thu Sep 6 17:48:27 EDT 2012


On Fri, Sep 7, 2012 at 12:56 AM, Tigerstyle <laddosingh at gmail.com> 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 'dict' type; you may find
it easier to work with for this sort of job. You can map an extension
("txt") to its count (4) directly.

ChrisA



More information about the Python-list mailing list