numpy字符串操作rfind()函数
numpy.core.defchararray.find(arr, sub, start=0, end=None)是另一个在numpy中进行字符串操作的函数。它返回在字符串中找到子串sub的最高索引,对于arr中的每个元素,如果sub不包含在[start, end]中,它返回-1。
参数:
arr : 类似于str或unicode的数组。
sub : [str or unicode] 要搜索的子串。
start : [ int, optional] 每个字符串的起始位置。
end : [ int, optional] 每个字符串中的结束位置。
返回: [ndarray] 输出整数的数组。
代码#1:
输出:
代码#2:
输出: