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