|
发表于 2017-6-24 20:44:46
|
显示全部楼层
其实遇到这种内置函数的问题,可以先看帮助文档的:
里面写的很清楚,把首尾相应的字符去除掉,中间的是不会删除的
str.strip([chars])
Return a copy of the string with the leading and trailing characters removed. The chars argument is a string specifying the set of characters to be removed. If omitted or None, the chars argument defaults to removing whitespace. The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped:
>>> ' spacious '.strip()
'spacious'
>>> 'www.example.com'.strip('cmowz.')
'example' |
|