python去除字符串空格

字符串里有三个去空格的函数
strip 同时去掉左右两边的空格
lstrip 去掉左边的空格
rstrip 去掉右边的空格

>>>a=” gho stwwl “
>>>a.lstrip()
‘gho stwwl ‘
>>>a.rstrip()
‘ gho stwwl’
>>>a.strip()
‘gho stwwl’



发表评论

您的电子邮箱地址不会被公开。

74 − = 64