I am trying to change an extension for a file, and I got two options.
os.path.splitext(os.path.basename(g_filename))[0] + ".new"
os.path.basename(g_filename).split('.')[0] + ".new"
Both gives the same output. So i am getting a new file called oldfile.new
from oldfile.old
No possibility of having too many '.'
in the file name.
Which is better of these two? What is the thumb rule (if any)?