numpy.strings.find#
- strings.find(a, sub, start=0, end=None)[source]#
对于每个元素,返回字符串中找到子字符串
sub
的最低索引,使得sub
包含在 [start
,end
) 范围内。- 参数:
- a类数组,带有
StringDType
、bytes_
或str_
数据类型 - sub类数组,带有 np.bytes_ 或 np.str_ 数据类型
要搜索的子字符串。
- start, end类数组,带有任意整数数据类型
要查找的范围,解释方式与切片表示法相同。
- a类数组,带有
- 返回:
- yndarray
整数输出数组
另请参阅
示例
>>> import numpy as np >>> a = np.array(["NumPy is a Python library"]) >>> np.strings.find(a, "Python") array([11])