def _replace ( self , data , replacements ) : for find , repl in replacements : data = data . replace ( find , repl ) return data
how to replace multiple with one in python
Given a list of 2 - tuples ( find repl ) this function performs all replacements on the input and returns the result .
def _replace(self, data, replacements):
        """
        Given a list of 2-tuples (find, repl) this function performs all
        replacements on the input and returns the result.
        """
        for find, repl in replacements:
            data = data.replace(find, repl)
        return data