Showing posts with label String strip() Method. Show all posts
Showing posts with label String strip() Method. Show all posts

Friday, March 9, 2018

String strip() Method


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!!!