Python 去除字符串空格


原文链接: Python 去除字符串空格
a = "   x y  z   "
print a.strip()         #return "x y  z"
print a.lstrip()        #return "x y  z   "
print a.rstrip()        #return "   x y  z"
print a.replace(' ','')     #return "xyz"
`