Send As SMS

4/17/2006

remove whitespace in python

assuming you've got some string named foo, to remove leading white space:

>>> foo.lstrip()
to remove trailing whitespace:
>>> foo.rstrip()
to remove both lead and trailing whitespace:
>>> foo.strip()


0 Comments:

Post a Comment

Links to this post:

Create a Link

<< Home

My blog has moved! Redirecting...

You should be automatically redirected. If not, visit http://stinkpot.afraid.org:8080/tricks/ and update your bookmarks.