Created
August 4, 2017 17:22
-
-
Save qqpann/7ded2adea061ab41e9ecac53a6178eb5 to your computer and use it in GitHub Desktop.
This file contains 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
# string | |
string = 'A string with what to be replaced.' | |
result = string.replace('what to be replaced', 'what to replace') | |
# regex | |
import re | |
result = re.sub(r'what to be replaced', 'what to replace', string) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment