Remove items from a list

Leif K-Brooks eurleif at ecritters.biz
Wed Sep 8 01:15:56 EDT 2004


Stan Cook wrote:
> I was trying to take a list of files in a directory and remove all but the ".dbf" files.

Assuming the variable "files" is the list of files:

files = [fname for fname in files if fname.endswith('.dbf')]



More information about the Python-list mailing list