Hi, I tried that, but it doesn't seem to work. My file directory has many different files extensions, and I want it to return me a number based on the number of files with similar files extensions. But when I tried running it, I get many weird numbers. Below is my code i had so far and the result.
import os directory = raw_input("Please input file directory. \n\n") s = raw_input("Please input a name to replace. \n\n") ext = raw_input("input file ext") for files in os.listdir(directory): if ext in files: file_number = len(files) print file_number The result is: 13 13 13 6 15 8 10 10 8 7 5 where the result should be just 11. Can anyone help me? Thanks. -- http://mail.python.org/mailman/listinfo/python-list