numpy.char.join#

char.join(sep, seq)[source]#

返回一個字串,該字串是序列 seq 中字串的串聯。

逐元素呼叫 str.join

參數:
separray-like,具有 StringDTypebytes_str_ dtype
seqarray-like,具有 StringDTypebytes_str_ dtype
返回:
outndarray

輸出 StringDTypebytes_str_ dtype 的陣列,取決於輸入類型

參見

str.join

範例

>>> import numpy as np
>>> np.strings.join('-', 'osd')  
array('o-s-d', dtype='<U5')  
>>> np.strings.join(['-', '.'], ['ghc', 'osd'])  
array(['g-h-c', 'o.s.d'], dtype='<U5')