Python Strip: Remove Leading & Trailing Spaces
In Python, you can utilize the strip() method to remove leading and trailing whitespaces from a string. For example:
s = " hello world "
s_stripped = s.strip()
print(s_stripped)
The output result is:
hello world