Function `os.path.splitext()` will return tuple of file name and file extension. Then we select file extension and replace dot. Of course may be needed replace only first dot, but I not see with double extension file types.