numpy.char.rindex#

char.rindex(a, sub, start=0, end=None)[source]#

rfind 类似,但当未找到子字符串 sub 时会引发 ValueError

参数:
a类数组,其 dtype 为 np.bytes_np.str_
sub类数组,其 dtype 为 np.bytes_np.str_
start, end类数组,其 dtype 为任意整数类型,可选
返回:
outndarray

整数输出数组。

另请参阅

rfind, str.rindex

示例

>>> a = np.array(["Computer Science"])
>>> np.strings.rindex(a, "Science", start=0, end=None)
array([9])