Skip to content

Instantly share code, notes, and snippets.

@josephmosby
Created October 2, 2012 23:30
Show Gist options
  • Save josephmosby/3823984 to your computer and use it in GitHub Desktop.
Save josephmosby/3823984 to your computer and use it in GitHub Desktop.
Recursive Find/Replace
def apply_converter(match, replacement, test_string):
if match in test_string:
pos = test_string.find(match)
new_string = test_string.replace(match, replacement)
return apply_converter(converter, new_string)
else:
return test_string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment