numpy.strings.find#

strings.find(a,sub,start=0,end=None)[source]#

For each element, return the lowest index in the string wheresubstringsub is found, such thatsub is contained in therange [start,end).

Parameters:
aarray_like, withStringDType,bytes_ orstr_ dtype
subarray_like, withnp.bytes_ ornp.str_ dtype

The substring to search for.

start, endarray_like, with any integer dtype

The range to look in, interpreted as in slice notation.

Returns:
yndarray

Output array of ints

See also

str.find

Examples

>>>importnumpyasnp>>>a=np.array(["NumPy is a Python library"])>>>np.strings.find(a,"Python")array([11])
On this page