(self, suffix)
return self._from_parsed_parts(self._drv, self._root,
                                       self._parts[:-1] + [name])
Return a new path with the file suffix changed.  If the path
        has no suffix, add given suffix.  If the given suffix is an empty
        string, remove the suffix from the path.
Return a new path with the file suffix changed.  If the path
        has no suffix, add given suffix.  If the given suffix is an empty
        string, remove the suffix from the path.
Return a new path with the file suffix changed . If the path has no suffix add given suffix . If the given suffix is an empty string remove the suffix from the path .
def with_suffix(self, suffix):
        """Return a new path with the file suffix changed.  If the path
        has no suffix, add given suffix.  If the given suffix is an empty
        string, remove the suffix from the path.
        """
        f = self._flavour
        if f.sep in suffix or f.altsep and f.altsep in suffix:
            raise ValueError("Invalid suffix %r" % (suffix,))
        if suffix and not suffix.startswith('.') or suffix == '.':
            raise ValueError("Invalid suffix %r" % (suffix))
        name = self.name
        if not name:
            raise ValueError("%r has an empty name" % (self,))
        old_suffix = self.suffix
        if not old_suffix:
            name = name + suffix
        else:
            name = name[:-len(old_suffix)] + suffix
        return self._from_parsed_parts(self._drv, self._root,
                                       self._parts[:-1] + [name])
def with_suffix ( self , suffix ) : f = self . _flavour if f . sep in suffix or f . altsep and f . altsep in suffix : raise ValueError ( "Invalid suffix %r" % ( suffix , ) ) if suffix and not suffix . startswith ( '.' ) or suffix == '.' : raise ValueError ( "Invalid suffix %r" % ( suffix ) ) name = self . name if not name : raise ValueError ( "%r has an empty name" % ( self , ) ) old_suffix = self . suffix if not old_suffix : name = name + suffix else : name = name [ : - len ( old_suffix ) ] + suffix return self . _from_parsed_parts ( self . _drv , self . _root , self . _parts [ : - 1 ] + [ name ] )