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