- strip() is a python in-build function which are used to remove the same content from the string at both end.
- It is combine form of lstrip() and rstrip().
- lstrip() remove left content
- rstrip() remove right content
- so strip() remove the same content at both side of string.
Syntax-
str.strip("str")
Example
string is s="---hello---"
s.strip("-") will give "hello"
program-
s="111111111mytext1111111"
print(s.strip("1"))
s="22222mytext222"
print(s.strip("2"))
s="111111111mytext2222"
print(s.strip("1"))
print(s.strip("2"))
print((s.strip("1")).strip("2"))
mytext
mytext
mytext2222
111111111mytext
mytext