numpy.char.find#
- char.find(a, sub, start=0, end=None)[源代码]#
对于每个元素,返回字符串中找到子字符串
sub的最低索引,使得sub包含在范围 [start,end) 中.- 参数:
- a : 类数组,具有
StringDType,bytes_或str_数据类型array_like, withStringDType,bytes_orstr_dtype - sub : 类数组,具有 np.bytes_ 或 np.str_ 数据类型array_like, with np.bytes_ or np.str_ dtype
要搜索的子字符串.
- start, endarray_like,具有任何整数 dtype
要查找的范围,以切片表示法解释.
- a : 类数组,具有
- 返回:
- yndarray
整数的输出数组
参见
示例
>>> import numpy as np >>> a = np.array(["NumPy is a Python library"]) >>> np.strings.find(a, "Python") array([11])