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
整数输出数组。
另请参阅
示例
>>> a = np.array(["Computer Science"]) >>> np.strings.rindex(a, "Science", start=0, end=None) array([9])