Usually when splitting strings on spaces, developers will tend to rely on str.split, which is able to serve that purpose pretty well. But when the need to split some spaces and preserve others arises, things quickly become harder and implementing a custom solution can require investing time in proper escaping.
Splitting strings and preserving spaces
How to do it...
Just rely on shlex.split instead of str.split:
>>> import shlex
>>>
>>> text = 'I was sleeping at the "Windsdale Hotel"'
>>> print(shlex.split(text))
['I', 'was', 'sleeping', 'at', 'the', 'Windsdale Hotel']