Problem with filter()

Birone Lynch bironelynch at gmail.com
Tue Apr 3 12:26:09 EDT 2007


"""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."""
>
>
I think the problem is the first "if" - using the list from your previous
mail, stringx[0] is never empty. So the filter fn never returns true, & the
return list is empty...
stringx[4] never matches either.

This is what I did:
>>> compFiles=['logs', 'rqp-8.2.104.0.dep', 'rqp-8.2.93.0.dep', '
rqp-win32-app-8.2.96.0-inst.tar.gz', 'rqp-win32-app-8.2.96.0-inst.tar.gz ']
>>> for i in compFiles:
            print i.split('-')   # ie the equivalent of stringx

['logs']
['rqp', '8.2.104.0.dep']
['rqp', '8.2.93.0.dep']
['rqp', 'win32', 'app', ' 8.2.96.0', 'inst.tar.gz']
['rqp', 'win32', 'app', ' 8.2.96.0', 'inst.tar.gz']

Birone
PS - I'm new at this.  Please forgive me if I got it totally wrong!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070403/e1e6e18d/attachment.html>


More information about the Python-list mailing list