900字范文,内容丰富有趣,生活中的好帮手!
900字范文 > python strip()方法 去除字符串头尾指定字符 默认为空格 换行符 制表符 回车符

python strip()方法 去除字符串头尾指定字符 默认为空格 换行符 制表符 回车符

时间:2022-08-11 18:41:06

相关推荐

python strip()方法 去除字符串头尾指定字符 默认为空格 换行符 制表符 回车符

Python strip() 方法用于移除字符串头尾指定的字符(默认为空格)或字符序列。

注意:该方法只能删除开头或是结尾的字符,不能删除中间部分的字符。

def strip(self, chars=None): # real signature unknown; restored from __doc__"""S.strip([chars]) -> strReturn a copy of the string S with leading and trailingwhitespace removed.返回删除前导和尾随空格的字符串S的副本。If chars is given and not None, remove characters in chars instead.如果给定chars而不是None,则改为删除chars中的字符。"""return ""

参考文章:Python3 strip()方法

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。