功能:
Python3 strip()方法可以去除字符串首尾指定的字符
语法:str.strip([chars]);参数说明:
str:需要进行操作的字符串
chars:可选参数,默认为空格,意为指定去除的字符
返回值:
返回源字符串去除首尾指定字符后的新字符串。
注意事项:
1、该方法相当于lstrip()以及rstrip()的组合体。
2、其余字符串方法见:http://www.mihuguan.com/article/15703730746.html
实例说明:
>>> str=" hello mihuguan " >>> str.strip() 'hello mihuguan'
python2019-11-03
jQuery2021-02-03
python2019-11-04
python2019-11-11
css2020-01-18
python2019-10-08