NumPy - numpy.char.center() 函数 简述 此函数返回所需宽度的数组,以便输入字符串居中并在左侧和右侧填充fillchar. import numpy as np # np.char.center(arr, width,fillchar) print np.char.center('hello', 20,fillchar = '*') 复制 这是它的输出 - *******hello******** 复制 返回字符串函数