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