I have a really ugly command where I use many appended \"replace()\" methods to replace/substitute/scrub many different strings from an original string. For example:
You have the right idea. Use sequence unpacking to iterate each pair of values:
def replaceAllSubStrings(originalString, replacementArray): for in_rep, out_rep in replacementArray: originalString = originalString.replace(in_rep, out_rep) return originalString