Bytearray Methods
bytearray.isalnum()
Check that the data has at least one byte and every byte represents an ASCII letter or digit. Underscores, punctuation, whitespace and bytes above 127 fail the test. This is a binary token check, not Unicode alphanumeric validation. 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.isalnum()Return Value
bool
True when the stated condition holds; False otherwise.
Working Example
Example Snippetpython
for token in (bytearray(b'ID42'), bytearray(b'ID_42'), bytearray(b'123')): print(token, token.isalnum())