Python3 字符串
描述
rstrip() 删除 string 字符串末尾的指定字符,默认为空白符,包括空格、换行符、回车符、制表符。
语法
rstrip()方法语法:
str.rstrip([chars])
参数
返回值
返回删除 string 字符串末尾的指定字符后生成的新字符串。
实例
以下实例展示了rstrip()方法的使用方法:
以上实例输出结果如下:
this is good this is good this is g www.runoob.co banana *****this is string example....wow!!!