运维网's Archiver
论坛
›
Python
› Python菜谱-字符串去除空格
heberoxx
发表于 2017-5-4 10:57:13
Python菜谱-字符串去除空格
一般来说,字符串处理都需要空格
有三个方法处理来处理字符串,lstrip,rstrip,strip。
x = ' hej '
print '|', x.lstrip( ), '|', x.rstrip( ), '|', x.strip( ), '|'
| hej | hej | hej |
页:
[1]
查看完整版本:
Python菜谱-字符串去除空格