First, remove !
by using str.replace()
and then split the string using str.split()
.
line="a but tuba!"
line = line.replace('!', '').split(' ')
print line
Output:
['a', 'but', 'tuba']
solved How do I split multiple characters without using any imported libraries?