You are here : python_2stringstringstrip

string.strip() - string

             

The method strip() 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).


  • chars -- The characters to be removed from beginning or end of the string.


Syntax

str.strip([chars]);


Example

#!/usr/bin/python

str = "0000000this is string example....wow!!!0000000";
print str.strip( '0' )


Output / Return Value

When we run above program, it produces following result −


this is string example....wow!!!


Limitations


Alternatives / See Also


Reference