table bytes and bytearray methods # syntax description ba append(iappends int (in range to bytearray ba capitalize(returns copy of bytes/bytearray with the first character capitalized (if it is an ascii letterb center(widthbytereturns copy of centered in length width padded with spaces or optionally with the given byte count(xstartendreturns the number of occurrences of bytes/bytearray in bytesbytearray (or in the start:end slice of bcharacter encodings decodeencodingerrorreturns str object that represents the bytes using the utf- encoding or using the specified encoding and handling errors according to the optional error argument endswith(xstartendreturns true if (or the start:end slice of bends with bytesbytearray or with any of the bytes/bytearrays in tuple xotherwisereturns false expandtabssizereturns copy of bytes/bytearray with tabs replaced with spaces in multiples of or of size if specified ba extend(seqextends bytearray ba with all the ints in sequence seqall the ints must be in the range find(xstartendreturns the leftmost position of bytes/bytearray in (or in the start:end slice of bor - if not found use the rfind(method to find the rightmost position fromhex(hreturns bytes object with bytes corresponding to the hexadecimal integers in str index(xstartendreturns the leftmost position of in (or in the start:end slice of bor raises valueerror if not found use the rindex(method to find the rightmost position ba insert(piinserts integer (in range at position in ba isalnum(returns true if bytes/bytearray is nonempty and every character in is an ascii alphanumeric character isalpha(returns true if bytes/bytearray is nonempty and every character in is an ascii alphabetic character isdigit(returns true if bytes/bytearray is nonempty and every character in is an ascii digit islower(returns true if bytes/bytearray has at least one lowercaseable ascii character and all its lowercaseable characters are lowercase returns true if bytes/bytearray is nonempty and every character in is an ascii whitespace character isspace(