Python String istrip & strip method

Python String lstrip() Method

  • The istrip( ) method removes any leading characters.

Syntax

  • string.lstrip(characters)  

Parameter 

Characters            :  A set of characters to remove as leading characters

Python String strip() Method

  • The strip() method returns a copy of the string with both leading and trailing characters removed (based on the string argument passed). 

  • The strip() removes characters from both left and right based on the argument (a string specifying the set of characters to be removed).

Syntax

  • string.strip(characters)  

Parameter

characters    :   A set of characters to remove as leading/trailing characters

 

 

 

Comments