Remove whitespace
Info:
Whitespace is the space before and/or after the actual text, and very often you want to remove this space.
How to do it?
You can do this by using the strip()
method. Here's an example:
greeting = " Hello, World! "
print(greeting.strip()) # returns "Hello, World!"