当前位置: 代码迷 >> 综合 >> strip()方法
  详细解决方案

strip()方法

热度:47   发布时间:2024-02-05 03:34:58.0

python strip()方法

str.strip(rm),移除字符串str首尾指定的字符rm;当rm为空时,默认删除空白符(包括’\n’,’\r’,’\t’,’ ')

>>> str = '00000032415670000\n'
>>> b = str.strip()
>>> b
'00000032415670000'
>>> c = b.strip(0)
>>> c
'3241567'