I want to eliminate all the whitespace from a string, on both ends, and in between words.
I have this Python code:
def my_handle(self): sentence
try this.. instead of using re i think using split with strip is much better
def my_handle(self): sentence = ' hello apple ' ' '.join(x.strip() for x in sentence.split()) #hello apple ''.join(x.strip() for x in sentence.split()) #helloapple