Make all files extension lower by a given directory name

Tiefeng Wu icebergwtf at yahoo.com.cn
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.

Thanks.

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


		
___________________________________________________________ 
抢注雅虎免费邮箱-3.5G容量,20M附件! 
http://cn.mail.yahoo.com



More information about the Python-list mailing list