String lstrip() will remove leading whitespaces in string and String rstrip will remove trailing whitespaces if char are none otherwise char are removed as shown below.

Str.lstrip() & Str.rstrip():

how to use str.rstrip & Str.lstrip in python
1.String lstrip() &String rstrip()

d string leading spaces removed when string lstrip() applied & when str.rstrip() applied it returned string with trailing whitespaces removed. On a string when lstrip applied with char “b” inserted it had removed b character in output.

By SC

One thought on “Str.lstrip &rstrip”

Leave a Reply

Your email address will not be published. Required fields are marked *