GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing www.geeksforgeeks.org — Python String strip() Method - GeeksforGeeks Python String strip() MethodLast Updated : 1 Jul, 2026 strip() method removes specified characters from both the beginning and the end of a string. If no characters are provided, it removes leading and trailing whitespace by default.
Output Python Programming Explanation: s.strip() removes spaces at the start and end of the string. Syntax
Removing Specific Charactersstrip() method can remove a specified set of characters from both ends of a string. This is useful for cleaning symbols, punctuation marks, or other unwanted characters.
Output Python Explanation: strip("#@") removes all # and @ characters from both ends. Characters inside the string are not affected. Removing Newline CharactersText read from files or user input often contains newline characters (\n). The strip() method can remove them from both ends of a string.
Output Python Programming Explanation: strip() removes leading and trailing newline characters. It also removes any surrounding whitespace characters by default. Removing Tabs and SpacesStrings may contain extra spaces or tab characters that need to be cleaned before processing.
Output Hello World Explanation: strip() removes tabs (\t) and spaces from both ends. The text between words remains unchanged. Comment Explore |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |