Is there a way to split a list of strings per character?
Here is a simple list that I want split per "!"
:
name1 = ['hello! i like apples!', ' my name is ! alfred!']
first = name1.split("!")
print(first)
I know it's not expected to run, I essentially want a new list of strings whose strings are now separated by "!"
. So output can be:
["hello", "i like apples", "my name is", "alfred"]