https://www.zhihu.com/question/19660572
视频:http://open.163.com/special/opencourse/bianchengdaolun.html
find返回的是匹配的第一个字符串的位置,而rfind返回的是匹配的最后一个字符串的位置。(==从右向左查,如果没有匹配项则返回-1。)
>>> str= 'hello,wrold'
>>> str.find('o')
4
>>> str.rfind('o')
8
https://www.zhihu.com/question/19660572
视频:http://open.163.com/special/opencourse/bianchengdaolun.html
find返回的是匹配的第一个字符串的位置,而rfind返回的是匹配的最后一个字符串的位置。(==从右向左查,如果没有匹配项则返回-1。)
>>> str= 'hello,wrold'
>>> str.find('o')
4
>>> str.rfind('o')
8