Python strip lstrip rstrip使用方法(字符串处理空格) strip是trim掉字符串两边的空格.lstrip, trim掉左边的空格rstrip, trim掉右边的空格 strip ( s [ , chars ] ) Return a copy of the string with leading and trailing characters removed. If chars is omitted or None , whitespace characters a…
最近在处理数据的时候,想把一个字符串开头的“)”符号去掉,所以使用targetStr.lstrip(")"),发现在 将处理完的数据插入到数据库时会出现编码报错,于是在网上搜到了这个帖子.出现上述编码错误问题的原因 是我对lstrip函数的理解错误,权威的解释如下: str.lstrip([chars]) Return a copy of the string with leading characters removed. The chars argument is a string…