Stripping whitespace from a string. : String strip : String PYTHON examples


PYTHON examples » String » String strip »

 

Stripping whitespace from a string.


Stripping whitespace from a string.

string1 = "t  n  This is a test string. tt n"

print 'Original string: "%s"n' % string1
print 'Using strip: "%s"n' % string1.strip()
print 'Using left strip: "%s"n' % string1.lstrip()
print 'Using right strip: "%s"n' % string1.rstrip()

           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo String
» String strip