numpy.char.add()



This function performs elementwise string concatenation.

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

Its output would be as follows −

Concatenate two strings:
['hello xyz']

Concatenation example:
['hello abc' 'hi xyz']
numpy_string_functions.htm
Advertisements