numpy.char.strip()


Advertisements

This function returns a copy of array with elements stripped of the specified characters leading and/or trailing in it.

import numpy as np 
print np.char.strip('ashok arora','a') 
print np.char.strip(['arora','admin','java'],'a')

Here is its output −

shok aror
['ror' 'dmin' 'jav']
numpy_string_functions.htm
Advertisements