You should take care of eventual empty strings when processing text starting/ending with seperator(s), for example for string from post #1.
Beside that I think we can agree that both
Personally I consider code with
Beside that I think we can agree that both
re.split()
with simple pattern and additional processing or re.findall()
with more complicated pattern and less additional processing (or even without any processing with "big" pattern) works.Personally I consider code with
re.findall()
from post #4 slightly more readable than additional processing after split, but thats just subjective opinion ...