Is there a function in Python to split a string without ignoring the spaces in the resulting list?
E.g:
s='This is the string I want to split'.split()
gives me
>>> s ['This', 'is', 'the', 'string', 'I', 'want', 'to', 'split']
I want something like
['This',' ','is',' ', 'the',' ','string', ' ', .....]
Using the capturing parentheses in re.split() causes the function to return the separators as well.