Created
March 10, 2009 21:12
-
-
Save taboularasa/77137 to your computer and use it in GitHub Desktop.
take out spaces inside of a string
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
>>> import re | |
>>> myString = "apple+ monkey+ bird+ cat+" | |
>>> myString = re.sub("\s+", "", myString) | |
>>> myString = myString.rstrip('+') | |
>>> print myString | |
apple+monkey+bird+cat |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment