question about endswith()

Mauro Caceres mauro.caceres at gmail.com
Fri Mar 4 12:59:41 EST 2011


if you could define extension to be a tuple, you could use it this way,
which is a little simpler:

extensions = ('hdf5',) #works
files =
('MOD03.A2010002.1810.005.2010258062733.hdf','MOD03.A2010002.1950.005.2010258063105.hdf','MOD03.A2010002.1950.005.2010258063105.hdf5')
for filename in files:
   if filename.endswith(extensions) :
       print filename

-- 
Mauro Cáceres
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20110304/aceda4dd/attachment-0001.html>


More information about the Python-list mailing list