numpy.char.str_len#

char.str_len(a)[source]#

Return len(a) element-wise.

Parameters:
aarray_like of str or unicode
Returns:
outndarray

Output array of integers

See also

len

Examples

>>> a = np.array(['Grace Hopper Conference', 'Open Source Day'])
>>> np.char.str_len(a)
array([23, 15])
>>> a = np.array([u'Р', u'о'])
>>> np.char.str_len(a)
array([1, 1])
>>> a = np.array([['hello', 'world'], [u'Р', u'о']])
>>> np.char.str_len(a)
array([[5, 5], [1, 1]])