Make all files extension lower by a given directory name

Tiefeng Wu icebergwtf at
Thu Nov 2 05:47:48 CET 2006

Fredrik Lundh wrote:
> that's not how splitext works, though:
> >>> os.path.splitext("FOO.BAR")
> ('FOO', '.BAR')
> can you post an example of a filename that misbehaves on your machine?
> </F>

To Fredrik Lundh and Tim Chase:

My task was read all tga file names and generate a config xml file,
then pass this xml file to a utility, but this utillity only read files with
extension 'tga' than 'TGA'.

I tried name + ext first but I got two dots between them, so I wrote
code that way (the strip thing), and it worked.
Today it does not work (the strip code cut last character from file name, like you said :) ),
and I changed it back, now everything is OK. I really don't know what
happened yesterday.


PS. I have python24, python25, python.NET and IronPython installed on my machine,
and .py file associate to python24.


More information about the Python-list mailing list