Problem with filter()
Boudreau, Emile
Emile.Boudreau at cognos.com
Tue Apr 3 10:52:07 EDT 2007
Hey all,
So I'm trying to filter a list with the built-in function
filter(). My list looks something like this:
['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']
Calling filter like this: compFiles = filter(is_Dev, compFiles)
compFiles is my list and is_dev is the following
def is_Dev(stringy):
print stringy
stringx = stringy.split('-')
if stringx[1] == r'win32':
if stringx[2] == r'app':
if stringx[4] == r'dev.tar.gz':
return 1
For some reason I only get 'logs' printed when is_Dev is called. (ie.
It's only going through is_dev once)
Does anyone see something wrong that I'm not seeing??
Thanks,
Emile Boudreau
This message may contain privileged and/or confidential information. If you have received this e-mail in error or are not the intended recipient, you may not use, copy, disseminate or distribute it; do not open any attachments, delete it immediately from your system and notify the sender promptly by e-mail that you have done so. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20070403/953d62a4/attachment.html>
More information about the Python-list
mailing list