On 4/3/07, Boudreau, Emile <[EMAIL PROTECTED]> wrote: > Sorry folks my mistake def is_dev should be: > def is_Dev(stringy): > stringx = stringy.split('-') > if stringx[0] == '': > if stringx[1] == r'win32': > if stringx[2] == r'app': > if stringx[4] == r'dev.tar.gz': > return 1 > > But now the results of the filter is an empty list and i know it shouldn't > be.
Well, you haven't told us what you expect the result to be, but as far as I can tell, an empty list is the correct answer, because you don't have any files in your list that match your rules. This line > if stringx[0] == '': is very likely your problem. That requires that your file start with a '-', so that after you split it stringx[0] will equal ''. You may need something more like this: def is_Dev(stringy): print stringy try: stringx = stringy.split('-') if stringx[1] == r'win32': if stringx[2] == r'app': if stringx[4] == r'dev.tar.gz': return 1 except IndexError, e: pass That will still give you an empty list when run on your proposed inputs though, because none of them are of the form <something>-win32-app-<something>-dev.tar.gz If this doesn't help, please give us some sample inputs and what you expect the output to be. -- Jerry -- http://mail.python.org/mailman/listinfo/python-list