use regex and word boundary:
>>> s="Lorem/ipsum/dolor/sit amet consetetur"
>>> import re
>>> re.sub(r"\b \b","",s)
'Lorem/ipsum/dolor/sit ametconsetetur'
>>>
This technique also handles the more general case:
>>> s="Lorem/ipsum/dolor/sit amet consetetur adipisci velit"
>>> re.sub(r"\b \b","",s)
'Lorem/ipsum/dolor/sit ametconsetetur adipiscivelit'
for start & end spaces, you'll have to work slightly harder, but it's still doable:
>>> s=" Lorem/ipsum/dolor/sit amet consetetur adipisci velit "
>>> re.sub(r"(^|\b) (\b|$)","",s)
'Lorem/ipsum/dolor/sit ametconsetetur adipiscivelit'
Just for fun, a last variant: use re.split
with a multiple space separation, preserve the split char using a group, then join the strings again, removing the spaces only if the string has some non-space in it:
"".join([x if x.isspace() else x.replace(" ","") for x in re.split("( {2,})",s)])
(I suppose that this is slower because of list creation & join though)