I wanted to know how to remove punctuation marks at the end and at the beginning of one or more words.
If there are punctuation marks between the word, we don’t remove.
for example
input:
word = "!.test-one,-"
output:
word = "test-one"
>Solution :
use strip
>>> import string
>>> word = "!.test-one,-"
>>> word.strip(string.punctuation)
'test-one'