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: f = open(filename, "w") f.write("Some text\n") f.close() name , ext = os.path.splitext(f.name) extensions.append(ext) # This would print all the files and directories for file in dirs: print(file) for ext, count in Counter(extensions).items(): print("Count for %s: " % ext, count) --- I need to make this module into a function and write a separate module to verify by testing that the function gives correct results. Help and pointers are much appreciated. T -- http://mail.python.org/mailman/listinfo/python-list