In this tutorial, we will remove all punctuations in a text sentence using python. We will use string.punctuation to implement.
1. Import python string package
import string
2. Remove all punctuations in a text sentence
sentence = 'cocyer.com is a tutorial and example site.' sen = [w for w in sentence if w not in string.punctuation] sen = "".join(sen) print(sen)
Run this code, you will get sen:
cocyercom is a tutorial and example site
Reference
Understand Python string.punctuation and Remove Punctuation in a Sentence