NumPy 字符串函数 numpy.char.encode() 此函数在数组中的每个元素上调用str.encode函数。默认编码为utf_8,可以使用标准Python库中的编解码器。 import numpy as np a = np.char.encode('hello', 'cp500') print aPythonCopy 其输出如下: �����PythonCopy