bytes.lstrip()

bytes.lstrip([chars]) bytearray.lstrip([chars])

Return a copy of the sequence with specified leading bytes removed. The chars argument is a binary sequence specifying the set of byte values to be removed - the name refers to the fact this method is usually used with ASCII characters. If omitted or None, the chars argument defaults to removing ASCII whitespace. The chars argument is not a prefix; rather, all combinations of its values are stripped:

>>> b'   spacious   '.lstrip()
b'spacious   '
>>> b'www.example.com'.lstrip(b'cmowz.')
b'example.com'

The binary sequence of byte values to remove may be any bytes-like object.

Note

The bytearray version of this method does not operate in place - it always produces a new object, even if no changes were made.

doc_python
2016-10-07 17:28:03
Comments
Leave a Comment

Please login to continue.