inp = "Hello world!"
and I expect something like that ["Hello"," ","world","!"]
>Solution :
using itertools.groupby
You can use itertools.groupby and a check with str.isalpha (which you can easily adapt to other character classes if needed):
s = "Hello world!"
from itertools import groupby
out = [''.join(g) for _,g in groupby(s, str.isalpha)]
output: ['Hello', ' ', 'world', '!']
using a regex
You can also use a regex and split on the word boundaries (dropping the first item that is the sentence start):
s = "Hello world!"
import re
out = re.split(r'\b', s)[1:]
output: ['Hello', ' ', 'world', '!']
NB. don’t use input as variable name, this is a python builtin