Remove items from a list

Stan Cook scook at elp.rr.com
Tue Sep 7 23:59:26 EDT 2004


I was trying to take a list of files in a directory and remove all but the ".dbf" files.  I used the following to try to remove the items, but they would not remove.  Any help would be greatly appreciated.

x = 0
for each in _dbases:
    if each[-4:] <> ".dbf":
            del each            # also tried:   del _dbases[x]
    x = x + 1

I must be doing something wrong, but it acts as though it is....

signed
. . . . . at the end of my rope....!


---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.749 / Virus Database: 501 - Release Date: 9/1/04
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20040908/4ab05ea7/attachment.html>


More information about the Python-list mailing list