NumPy char center

NumPy char center

In this chapter, we will discuss about NumPy char center.This function returns an array of the required width so that the input string is centered and padded on the left and right with fillchar.

import numpy as np 
# np.char.center(arr, width,fillchar) 
print np.char.center('hello', 20,fillchar = '*')

Here is its output −

*******hello********

Next Topic – Click Here

This Post Has 2 Comments

Leave a Reply