本文簡要介紹 python 語言中 numpy.char.endswith
的用法。
用法:
char.endswith(a, suffix, start=0, end=None)
返回一個布爾數組,即True其中字符串元素在a以。。結束後綴, 否則False.
逐元素調用
str.endswith
。- a: 類似 str 或 unicode 的 數組
- suffix: str
- start, end: 整數,可選
使用可選開始,從該位置開始測試。使用可選結束,在該位置停止比較。
- out: ndarray
輸出一個布爾數組。
參數:
返回:
例子:
>>> 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])
相關用法
- Python numpy char.strip用法及代碼示例
- Python numpy char.upper用法及代碼示例
- Python numpy char.count用法及代碼示例
- Python numpy char.chararray用法及代碼示例
- Python numpy char.rstrip用法及代碼示例
- Python numpy char.decode用法及代碼示例
- Python numpy char.compare_chararrays用法及代碼示例
- Python numpy char.lstrip用法及代碼示例
- Python numpy char.lower用法及代碼示例
- Python numpy char.swapcase用法及代碼示例
- Python numpy char.title用法及代碼示例
- Python numpy char.capitalize用法及代碼示例
- Python numpy char.chararray.tostring用法及代碼示例
- Python numpy chararray.ndim用法及代碼示例
- Python numpy chararray.nbytes用法及代碼示例
- Python numpy chararray.setflags用法及代碼示例
- Python numpy chararray.flat用法及代碼示例
- Python numpy chararray.strides用法及代碼示例
- Python numpy chararray.view用法及代碼示例
- Python numpy chararray.imag用法及代碼示例
- Python numpy chararray.base用法及代碼示例
- Python numpy chararray.flatten用法及代碼示例
- Python numpy chararray.copy用法及代碼示例
- Python numpy chararray.resize用法及代碼示例
- Python numpy chararray.sort用法及代碼示例
注:本文由純淨天空篩選整理自numpy.org大神的英文原創作品 numpy.char.endswith。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。