删除字符串空格方法

"   abc   ".strip()            # returns "abc"  
"   xyz   ".lstrip()           # returns "xyz   "  
"   xyz   ".rstrip()           # returns "   xyz"  
"  x y z  ".replace(' ', '')   # returns "xyz" 

 

posted @ 2017-06-19 16:25  道高一尺  阅读(181)  评论(0)    收藏  举报