/  strip() method in Python String Module

strip() method in Python String Module


strip method in string module returns the output by removing the unwanted or extra spaces from both left and right sides in the string.


Syntax:

Str.strip()


Example-1:

text = "      Charminar and Golconda    "
x = text.strip()
print("Both", x, "are in Telangana")


Output: