https://docs.python.org/3/library/stdtypes.html?highlight=strip#str.strip
The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped"
常见新手坑
Python 文档是这么解释的。
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.
a.strip('gz.')会得到一样的结果,strip 的参数仅表示从开头或结尾移除的字符集
Syntax
string.strip(characters)
Parameter Values
Parameter Description
characters Optional. A set of characters to remove as leading/trailing characters
哈哈,看见有人踩自己踩过的坑真的好开心
复制于 2 楼:
https://docs.python.org/3/library/stdtypes.html?highlight=strip#str.strip
The chars argument is not a prefix or suffix; rather, all combinations of its values are stripped"
常见新手坑