def replace_ext(path, ext):
 ext_dot = ('.' + ext)
 return (os.path.splitext(path)[0] + ext_dot)

def replace_ext ( path , ext ) : ext_dot = ( '.' + ext ) return ( os . path . splitext ( path ) [ 0 ] + ext_dot )
return the path with its extension replaced by ext .