NumPy 字符串函数 numpy.char.add()
此函数执行逐元素的字符串拼接。
import numpy as np
print 'Concatenate two strings:'
print np.char.add(['hello'],[' xyz'])
print '\n'
print 'Concatenation example:'
print np.char.add(['hello', 'hi'],[' abc', ' xyz'])
它的输出将如下所示 –
Concatenate two strings:
['hello xyz']
Concatenation example:
['hello abc' 'hi xyz']