numpy.core.defchararray.endswith¶
-
numpy.core.defchararray.
endswith
(a, suffix, start=0, end=None)[源代码]¶ 返回一个布尔数组,该数组是 True 其中的字符串元素 a 以结束 suffix ,否则 False .
电话 str.endswith 元素的。
参数: - a : 类似str或unicode的数组
- 后缀 : STR
- 开始,结束 : 可选的
任选 start ,从该位置开始测试。任选 end 在那个位置停止比较。
返回: - out : 恩达雷
输出一组bools。
参见
实例
>>> s = np.array(['foo', 'bar']) >>> s[0] = 'foo' >>> s[1] = 'bar' >>> s array(['foo', 'bar'], dtype='|S3') >>> np.char.endswith(s, 'ar') array([False, True]) >>> np.char.endswith(s, 'a', start=1, end=2) array([False, True])