Description
The Python Strip () method removes the character specified by the string's Kinsoku (the default is a space).
Grammar
Strip () method syntax:
Str.strip ([chars]);
Parameters
Chars--Removes the character specified by the tail of the string.
return value
Returns a new string that is generated by removing the string from the Kinsoku specified character.
Example
The following example shows how the strip () function is used:
# !/usr/bin/python "0000000this is string EXAMPLE....WOW!!! 0000000"; Print ' 0 ' );
The result of the above example output is as follows:
this is string example....wow!!!
Removes only the characters specified by the beginning and ends of the string, and the middle part is not removed:
# !/usr/bin/python "0000000this is string 0000EXAMPLE....WOW!!! 0000000"; Print ' 0 ' );
0 of the intermediate part of the output is still present:
this is string 0000example....wow!!!
Python Strip () method