Re: [Tutor] how to alter list content

2005-10-13 Thread w chun
combining the best of both worlds of nick using a faster list comp and brett using os.path.splitext():>>> files = ['DSC1.JPG', 'DSC2.JPG', 'DSC3.JPG']>>> newFiles = [os.path.splitext (f)[0] for f in files]>>> print newFiles['DSC1', 'DSC2', 'DSC3']cheers,-- wesley- - - - - -

Re: [Tutor] how to alter list content

2005-10-13 Thread Brett Hoerner
> i create a list of all JPG files with: > >>> list = glob.glob('*.JPG') > the content of 'list' is now: > >>> print list > ['DSC1.JPG', 'DSC2.JPG', 'DSC3.JPG'] > > but what i want is this type of list: > ['DSC1', 'DSC2', 'DSC3'] I would make use of os.path.splitext, which

Re: [Tutor] how to alter list content

2005-10-13 Thread Nick Lunt
Hi marc, > > i create a list of all JPG files with: > >>> list = glob.glob('*.JPG') > the content of 'list' is now: > >>> print list > ['DSC1.JPG', 'DSC2.JPG', 'DSC3.JPG'] > > but what i want is this type of list: > ['DSC1', 'DSC2', 'DSC3'] > i.e. the names w/o the file e

[Tutor] how to alter list content

2005-10-13 Thread Marc Buehler
hi. i create a list of all JPG files with: >>> list = glob.glob('*.JPG') the content of 'list' is now: >>> print list ['DSC1.JPG', 'DSC2.JPG', 'DSC3.JPG'] but what i want is this type of list: ['DSC1', 'DSC2', 'DSC3'] i.e. the names w/o the file extension. what's the easi