So I am trying to turn a string with multiple separators into a list, but dictated by where the separators are:
ex: ("Hooray! Finally, we're done.", "!,") to be converted to: ['Hooray', ' Finally', " we're done."] based upon the separators given.
As you can see, the string is split into a list based on the separators. My closest attempt:
for ch in separators:
original = ' '.join(original.split(ch))
return(original.split())
when I do this I get the result:
['Hooray', 'Finally', "we're", 'done.']
but I need to have " we're done" as one element of the list, not separated.
I got a suggestion to use a string accumulator, but I don't see how it helps to solve the issue
Thanks