rstrip()

作者: leomei91 | 来源:发表于2017-06-08 15:47 被阅读0次

定义:删除字符串末尾的指定字符。

语法:

str.rstrip('/')

说明:不管有几个/都会被删除。

例子:

url = "http://example.com/path/to/file/////"
u = url.rstrip('/')
print u
结果
"http://example.com/path/to/file"

相关文章

网友评论

    本文标题:rstrip()

    本文链接:https://www.haomeiwen.com/subject/cyhtqxtx.html