python split sentence into words without punctuation code example
Example 1: remove punctuation from string python
#with re
import re
s = "string. With. Punctuation?"
s = re.sub(r'[^\w\s]','',s)
#without re
s = "string. With. Punctuation?"
s.translate(str.maketrans('', '', string.punctuation))
Example 2: python split sentence into words
sentence = 'Hello world a b c'
split_sentence = sentence.split(' ')
print(split_sentence)