Skip to content

Instantly share code, notes, and snippets.

@raeq
Created July 18, 2020 19:27
Show Gist options
  • Save raeq/8c3ea8ec42748a6be0701b592866d476 to your computer and use it in GitHub Desktop.
Save raeq/8c3ea8ec42748a6be0701b592866d476 to your computer and use it in GitHub Desktop.
Use the replace function
def remove_unwanted(original: str = "",
unwanted: str = "",
replacement: str = "") -> str:
return original.replace(unwanted, replacement)
assert remove_unwanted(original="M'The Real String'",
unwanted="M") == "'The Real String'"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment