combining the best of both worlds of nick using a faster list comp and brett using os.path.splitext():

>>> files = ['DSC00001.JPG', 'DSC00002.JPG', 'DSC00003.JPG']
>>> newFiles = [os.path.splitext (f)[0] for f in files]
>>> print newFiles
['DSC00001', 'DSC00002', 'DSC00003']

cheers,
-- wesley
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
"Core Python Programming", Prentice Hall, (c)2006,2001
    http://corepython.com

wesley.j.chun :: wescpy-at-gmail.com
cyberweb.consulting : silicon valley, ca
http://cyberwebconsulting.com
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to