String strip() Method in Python 3
The strip() method returns a copy of the string in which all chars have been
stripped from the beginning and the end of the string (default
whitespace characters).
Syntax
str.strip([chars]);
|
Parameters
chars - The characters to be removed from beginning
or end of the string.
Return Value
This method returns a copy of the string in which all
the chars have been stripped from the beginning and the end of the string.
Example
#!/usr/bin/python3
str =
"*****this is string example....wow!!!*****"
print
(str.strip( '*' ))
|
Result
this is
string example....wow!!!
|