Bytearray Methods

bytearray.isspace()

Check that a nonempty sequence consists entirely of ASCII space, tab, newline, carriage return, vertical tab or form feed (values 32 and 9–13). Other control values and non-ASCII whitespace encodings do not qualify. Empty input returns False. The receiver is not modified. Returns a Boolean, not a transformed sequence. These operations are intended for ASCII-compatible data, not arbitrary binary formats.

Formal Syntax & Structure

python syntaxpython
data.isspace()

Return Value

bool

True when the stated condition holds; False otherwise.

Working Example

Example Snippetpython
for token in (bytearray(b' \t\r\n\x0b\x0c'), bytearray(b' a'), bytearray(b'')):    print(token, token.isspace())
Python Reference