numpy.char.encode()


Advertisements


This function calls str.encode function for each element in the array. Default encoding is utf_8, codecs available in standard Python library may be used.

Live Demo
import numpy as np 
a = np.char.encode('hello', 'cp500') 
print a

Its output is as follows −

�����

numpy_string_functions.htm

Advertisements