question about endswith()

Matt Funk mafunk at nmsu.edu
Thu Mar 3 18:39:35 EST 2011


Hi,
i have a list of files, some of which end with .hdf and one of them end
with hdf5. I want to filter the hdf5 file. Thereforei set extensions: hdf5
I try to filter as below:
if (any(filename.endswith(x) for x in extensions)):

The problem is that i let's all files though rather than just the hdf5
file. Is there anything i am doing wrong?

thanks
matt



More information about the Python-list mailing list