Created
March 15, 2016 06:02
-
-
Save chris-zh/2051b1cd2dc0b055ba8a to your computer and use it in GitHub Desktop.
Python去除字符串外的空格
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
" xyz ".strip() # returns "xyz" | |
" xyz ".lstrip() # returns "xyz " | |
" xyz ".rstrip() # returns " xyz" | |
" x y z ".replace(' ', '') # returns "xyz" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment