Re: [Tutor] A simpler mousetrap

2004-12-16 Thread Kent Johnson
As Wolfram pointed out, os.path.splitext() is a good way to do this. It is also more robust than the other solutions because it does the right thing if there is no extension on the original file name. I just want to say that your first solution can be written much more simply as x=a[:a.rfind('.')

[Tutor] A simpler mousetrap

2004-12-16 Thread Liam Clarke
Hi all, I'm writing some code, and I want to take a given path + filename, and change the file extension to *.bak. In doing so, (entirely internal this function), I am assuming - That the file will always have an extension Thathe extension will vary But, it will follow the general DOS format of