Hi again!

(Now that everyone was so helpful the first time you'll never get rid of me!)

I had a question about using the index() function on a list -- as I
walk the directory path, I want to see if a directory contains any
files ending in a certain type ... if it does, I wanna do some stuff
... if not, I would like to move on ... .

for dirpath, subFolders, files in os.walk(rootDir):
     try:
         i = files.index("*.flac") #how do I make it search for files
that end in ".flac" ?
         for file in files:
                #do some things in here to sort my files
     except ValueError:
         pass

Basically: how do I make it match *.flac ?  I couldn't find anything
on google (searching for "python index" just gets me a lot of indexes
of python docs - wink)

Thanks again,

Damon
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to