I want to remove any extra whitespace in a sentece how can i do this with python? for ex :
("  hello   world") >>>  ("hello world")
I want to remove any extra whitespace in a sentece how can i do this with python? for ex :
("  hello   world") >>>  ("hello world")
 
    
    str = " hello     world "
str_clean = ' '.join(str.split())
print(str_clean)
hello world
Edited, I think I overlooked your initial text.
