def str_ripper ( self , text ) : return self . pattern . sub ( lambda m : self . rep [ re . escape ( m . group ( 0 ) ) ] , text )
use replace in python to cut characters
Got this code from here : http : // stackoverflow . com / questions / 6116978 / python - replace - multiple - strings
def str_ripper(self, text):
        """Got this code from here:
        http://stackoverflow.com/questions/6116978/python-replace-multiple-strings

        This method takes a set of strings, A, and removes all whole
        elements of set A from string B.

        Input: text string to strip based on instance attribute self.censor
        Output: a stripped (censored) text string
        """
        return self.pattern.sub(lambda m: self.rep[re.escape(m.group(0))], text)