Use regular expressions:
import re newString = re.sub("[" + charsToRemove + "]", "", stringToModify)
As a specific example, the following excludes all occurrences of "a", "m", and "z" from a sentence:
import re print re.sub("[amz]", "", "the quick brown fox jumped over the lazy dog")
This will remove all characters from "m" to "s":
re.sub("[ms]", "", "the quick brown fox jumped over the lazy dog")
source share