Created
June 29, 2018 18:34
-
-
Save himlohiya/89c96851ffedf89638abb126ca37e430 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
def remove_special_characters(text, remove_digits=False): | |
pattern = r'[^a-zA-z0-9\s]' if not remove_digits else r'[^a-zA-z\s]' | |
text = re.sub(pattern, '', text) | |
return text |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment