您的呼叫告诉rfind 开始查看
索引34。您想使用带有字符串,开始和结束的rfind重载。告诉它从字符串(
0)的开头开始,然后停止查看
index:
>>> s = "Hello, I am 12! I like plankton but I don't like baseball.">>> index = 34 #points to the 't' in 'but'>>> index_of_2nd_I = s.rfind('I', 0, index)>>>>>> index_of_2nd_I16
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)