Created
July 18, 2020 19:27
-
-
Save raeq/8c3ea8ec42748a6be0701b592866d476 to your computer and use it in GitHub Desktop.
Use the replace function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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