numpy.char.endswith

char.endswith(a, suffix, start=0, end=None)[源代码]

返回一个布尔数组,该数组是 True 其中的字符串元素 a 以结束 suffix ,否则 False .

调用 str.endswith 元素的。

参数
a类似str或unicode的数组
suffixSTR
开始,结束可选的

任选 start ,从该位置开始测试。任选 end 在那个位置停止比较。

返回
out恩达雷

输出一组bools。

参见

str.endswith

实例

>>> s = np.array(['foo', 'bar'])
>>> s[0] = 'foo'
>>> s[1] = 'bar'
>>> s
array(['foo', 'bar'], dtype='<U3')
>>> np.char.endswith(s, 'ar')
array([False,  True])
>>> np.char.endswith(s, 'a', start=1, end=2)
array([False,  True])