(self, path)
return clean_path.rstrip('/')
Remove duplicate and trailing slashes
Remove duplicate and trailing slashes
Remove duplicate and trailing slashes
def cleanpath(self, path):
        """Remove duplicate and trailing slashes"""
        clean_path = ""
        p_char = ''
        for char in str(path):
            if not clean_path:
                clean_path = char
            else:
                if not (char == p_char and char == '/'):
                    clean_path += char
            p_char = char

        if clean_path == "/":
            return clean_path

        return clean_path.rstrip('/')
def cleanpath ( self , path ) : clean_path = "" p_char = '' for char in str ( path ) : if not clean_path : clean_path = char else : if not ( char == p_char and char == '/' ) : clean_path += char p_char = char if clean_path == "/" : return clean_path return clean_path . rstrip ( '/' )