Bytearray Methods

bytearray.isalpha()

Check that the data is nonempty and contains only ASCII letters A–Z or a–z. Digits, separators and high byte values are rejected. A UTF-8 encoding of a non-ASCII letter does not pass merely because the decoded character is alphabetic. 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.isalpha()

Return Value

bool

True when the stated condition holds; False otherwise.

Working Example

Example Snippetpython
for token in (bytearray(b'API'), bytearray(b'Api7'), bytearray(b'')):    print(token, token.isalpha())
Python Reference