Learn | NEPs | User Guide | API reference | Building from source | Development | Release notes | NumPy’s module structure | Array objects | Universal functions (ufunc) | Routines and objects by topic | Constants | Bit-wise operations | String functionality | Data type routines | Floating point error handling | Discrete Fourier Transform | Input and output | Linear algebra | Logic functions | Masked array operations | Mathematical functions | Miscellaneous routines | Random sampling | Set routines | Sorting, searching, and counting | Test support | Window functions
strings.find(a, sub, start=0, end=None)
For each element, return the lowest index in the string where substring sub is found, such that sub is contained in the range [start, end).
Parameters:aarray_like, with StringDType, bytes_ or str_ dtypesubarray_like, with bytes_ or str_ dtypeThe substring to search for.
start, endarray_like, with any integer dtypeThe range to look in, interpreted as in slice notation.
Returns:yndarrayOutput array of ints
Examples
>>> importnumpyasnp>>> a=np.array(["NumPy is a Python library"])>>> np.strings.find(a,"Python")array([11])