Remove items from a list

Stan Cook scook at
Wed Sep 8 05:59:26 CEST 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....

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

Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (
Version: 6.0.749 / Virus Database: 501 - Release Date: 9/1/04
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list