numpy.strings.rindex#
- strings.rindex(a, sub, start=0, end=None)[原始碼]#
如同
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])