python字符串操作常用操作,如字符串的替换、删除、截取、复制、连接、比较、查找、分割等,需要的朋友可以参考下。

1.去除空格
str.strip():删除字符串两边的指定字符,括号的写入指定字符,默认为空格

1 >>> a='   hello   '
2 >>> b=a.strip()
3 >>> print(b)
4 hello
View Code

相关文章:

  • 2022-02-10
  • 2021-06-07
  • 2021-10-16
  • 2022-02-08
  • 2022-12-23
  • 2022-12-23
  • 2021-10-01
猜你喜欢
  • 2021-09-05
  • 2021-10-31
  • 2021-07-26
  • 2021-11-07
相关资源
相似解决方案