1.strip()方法,去除字符串开头或者结尾的空格
2.lstrip()方法,去除字符串开头的空格
3:rstrip()方法,去除字符串结尾的空格
4:replace()方法,可以去除全部空格
python 中常见字符串去空格的方法
猜你喜欢
转载自blog.csdn.net/qq_38891369/article/details/105016447
今日推荐
周排行