描述
Python rfind() 返回字符串云计最后一次出现的位置,如果没有匹配项则返回-算开1。
语法
以下是 rfind() 方法语法:
st发:r.rfind(str, beg=0 endPy=len(string))
参数
str -- 查找的字符th串
beg -- 开始查找的位置,默认为0
end -on- 结束查找位置,默认为字符串的长度。
返回值
返回字3-符串最后一次出现的位置,如果没有匹配项则返回-1。
实rf例
以下实例展示了rfind()函数的使用方法:
以上in实例输出结果如下:
电话:020-123456789
传真:020-123456789
Copyright © 2026 Powered by 官场如戏网 https://sericeconstruction.com/