On this page
numpy.core.defchararray.strip
numpy.core.defchararray.strip(a, chars=None)[source]- 
    
For each element in
a, return a copy with the leading and trailing characters removed.Calls
str.stripelement-wise.Parameters: - 
           
a : array-like of str or unicode - 
           
chars : str or unicode, optional - 
           
The
charsargument is a string specifying the set of characters to be removed. If omitted or None, thecharsargument defaults to removing whitespace. Thecharsargument is not a prefix or suffix; rather, all combinations of its values are stripped. 
Returns: - 
           
out : ndarray - 
           
Output array of str or unicode, depending on input type
 
See also
Examples
>>> c = np.array(['aAaAaA', ' aA ', 'abBABba']) >>> c array(['aAaAaA', ' aA ', 'abBABba'], dtype='|S7') >>> np.char.strip(c) array(['aAaAaA', 'aA', 'abBABba'], dtype='|S7') >>> np.char.strip(c, 'a') # 'a' unstripped from c[1] because whitespace leads array(['AaAaA', ' aA ', 'bBABb'], dtype='|S7') >>> np.char.strip(c, 'A') # 'A' unstripped from c[1] because (unprinted) ws trails array(['aAaAa', ' aA ', 'abBABba'], dtype='|S7') - 
           
 
© 2005–2019 NumPy Developers
Licensed under the 3-clause BSD License.
 https://docs.scipy.org/doc/numpy-1.16.1/reference/generated/numpy.core.defchararray.strip.html