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']