In this example we will show how to remove any whitespace from the beginning or the end using the strip() method in Python.
Source Code
my_str = ' Python '
print(my_str)
print(my_str.strip())
Output:
Python
Python
In this example we will show how to remove any whitespace from the beginning or the end using the strip() method in Python.
my_str = ' Python '
print(my_str)
print(my_str.strip())
Output:
Python
Python