Last active
July 3, 2020 14:34
-
-
Save dardanxhymshiti/66854e6e545b6464e549ec13b29f92b5 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_punctuation_marks(text): | |
import string | |
import re | |
pattern = f'[%s]' % re.escape(string.punctuation) | |
text_wo_punctuation_marks = re.sub(pattern, '', text) | |
return text_wo_punctuation_marks | |
# Test | |
text = """Hello, World!""" | |
remove_punctuation_marks(text) | |
# 'Hello World' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment