Home / Python Tips Generated By ChatGPT / Stripping Whitespace: strip(), rstrip(), lstrip() in Python Remove whitespace from the beginning, end, or both sides of a string. Source Code user_input = " Python " print(user_input.strip())