在Python中查找字符串中字符的最后出现位置
我该如何找到一个字符串中最后出现的字符呢?
string = "abcd}def}"
string = string.find('}',last) # Want something like this
1 个回答
75
你可以使用 rfind
这个方法:
>>> "abcd}def}".rfind('}')
8