On this page
numpy.char.lstrip
- numpy.char.lstrip(a, chars=None)
- 
    For each element in a, return a copy with the leading characters removed.Calls str.lstripelement-wise.- Parameters
- 
      - aarray-like, {str, unicode}
- 
        Input array. 
- chars{str, 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; rather, all combinations of its values are stripped.
 
- Returns
- 
      - outndarray, {str, unicode}
- 
        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='<U7')The ‘a’ variable is unstripped from c[1] because whitespace leading. >>> np.char.lstrip(c, 'a') array(['AaAaA', ' aA ', 'bBABba'], dtype='<U7')>>> np.char.lstrip(c, 'A') # leaves c unchanged array(['aAaAaA', ' aA ', 'abBABba'], dtype='<U7') >>> (np.char.lstrip(c, ' ') == np.char.lstrip(c, '')).all() ... # XXX: is this a regression? This used to return True ... # np.char.lstrip(c,'') does not modify c at all. False >>> (np.char.lstrip(c, ' ') == np.char.lstrip(c, None)).all() True
© 2005–2020 NumPy Developers
Licensed under the 3-clause BSD License.
 https://numpy.org/doc/1.19/reference/generated/numpy.char.lstrip.html