numpy.strings.rindex#
- strings.rindex(a, sub, start=0, end=None)[source]#
类似于
rfind
,但当找不到子字符串 sub 时会引发ValueError
。- 参数:
- a类数组,具有 np.bytes_ 或 np.str_ 数据类型
- sub类数组,具有 np.bytes_ 或 np.str_ 数据类型
- start, end类数组,具有任意整数数据类型,可选
- 返回:
- outndarray
整数输出数组。
另请参阅
示例
>>> a = np.array(["Computer Science"]) >>> np.strings.rindex(a, "Science", start=0, end=None) array([9])