Staging: this is not the live site, pydocs.org.
bytearray(iterable_of_ints) -> bytearray
bytearray(string, encoding[, errors]) -> bytearray
bytearray(bytes_or_buffer) -> mutable copy of bytes_or_buffer
bytearray(int) -> bytes array of size given by the parameter initialized with null bytes
bytearray() -> empty bytes array
Construct a mutable bytearray object from:
- an iterable yielding integers in range(256)
- a text string encoded using the specified encoding
- a bytes or a buffer object
- any object implementing the buffer API.
- an integer Members of bytearray a append Append a single item to the end of the bytearray. c capitalize Return a copy of B with only its first character capitalized (ASCII) and the rest lower-cased. center Return a centered string of length width. clear Remove all items from the bytearray. count Return the number of non-overlapping occurrences of subsection 'sub' in bytes B[start:end]. d decode Decode the bytearray using the codec registered for encoding. e endswith Return True if the bytearray ends with the specified suffix, False otherwise. expandtabs Return a copy where all tab characters are expanded using spaces. extend Append all the items from the iterator or sequence to the end of the bytearray. f find Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end]. fromhex Create a bytearray object from a string of hexadecimal numbers. h hex Create a string of hexadecimal numbers from a bytearray object. i index Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end]. insert Insert a single item into the bytearray before the given index. isalnum Return True if all characters in B are alphanumeric and there is at least one character in B, False otherwise. isalpha Return True if all characters in B are alphabetic and there is at least one character in B, False otherwise. isascii Return True if B is empty or all characters in B are ASCII, False otherwise. isdigit Return True if all characters in B are digits and there is at least one character in B, False otherwise. islower Return True if all cased characters in B are lowercase and there is at least one cased character in B, False otherwise. isspace Return True if all characters in B are whitespace and there is at least one character in B, False otherwise. istitle Return True if B is a titlecased string and there is at least one character in B, i.e. isupper Return True if all cased characters in B are uppercase and there is at least one cased character in B, False otherwise. j join Concatenate any number of bytes/bytearray objects. l ljust Return a left-justified string of length width. lower Return a copy of B with all ASCII characters converted to lowercase. lstrip Strip leading bytes contained in the argument. m maketrans Return a translation table usable for the bytes or bytearray translate method. p partition Partition the bytearray into three parts using the given separator. pop Remove and return a single item from B. r remove Remove the first occurrence of a value in the bytearray. removeprefix Return a bytearray with the given prefix string removed if present. removesuffix Return a bytearray with the given suffix string removed if present. replace Return a copy with all occurrences of substring old replaced by new. resize Resize the internal buffer of bytearray to len. reverse Reverse the order of the values in B in place. rfind Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end]. rindex Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start:end]. rjust Return a right-justified string of length width. rpartition Partition the bytearray into three parts using the given separator. rsplit Return a list of the sections in the bytearray, using sep as the delimiter. rstrip Strip trailing bytes contained in the argument. s split Return a list of the sections in the bytearray, using sep as the delimiter. splitlines Return a list of the lines in the bytearray, breaking at line boundaries. startswith Return True if the bytearray starts with the specified prefix, False otherwise. strip Strip leading and trailing bytes contained in the argument. swapcase Return a copy of B with uppercase ASCII characters converted to lowercase ASCII and vice versa. t take_bytes Take *n* bytes from the bytearray and return them as a bytes object. title Return a titlecased version of B, i.e. translate Return a copy with each character mapped by the given translation table. u upper Return a copy of B with all ASCII characters converted to uppercase. z zfill Pad a numeric string with zeros on the left, to fill a field of the given width.
Python docs © Python Software Foundation · Examples CC0 ·
Source on GitHub · Not affiliated with the PSF