Python String strip() Method

Python String strip() Method

Example Remove spaces at the beginning and at the end of the string: txt = ” banana “x = txt.strip() print(“of all fruits”, x, “is my favorite”) Definition and Usage The <span>strip()</span> method removes any leading and trailing whitespaces. Leading means at the beginning of the string, trailing means at the end. You can specify … Read more