# Remove spaces at the beginning and at the end of a sting txt = " Hello World " print(txt.strip()) # Output - "Hello World"