Rechercher
 

Améliorations / Corrections

Vous avez des améliorations (ou des corrections) à proposer pour ce document : je vous remerçie par avance de m'en faire part, cela m'aide à améliorer le site.

Emplacement :

Description des améliorations :

Module « builtins »

Classe « bytearray »

Informations générales

Héritage

builtins.object
    builtins.bytearray

Définition

class bytearray(builtins.object):

Description [extrait de bytearray.__doc__]

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

Constructeur(s)

Signature du constructeur Description
__new__(*args, **kwargs) Create and return a new object. See help(type) for accurate signature. [extrait de __new__.__doc__]
__init__(self, /, *args, **kwargs) Initialize self. See help(type(self)) for accurate signature. [extrait de __init__.__doc__]

Liste des opérateurs

Signature de l'opérateur Description
__add__(self, value) Return self+value. [extrait de __add__.__doc__]
__contains__(self, key) Return key in self. [extrait de __contains__.__doc__]
__delitem__(self, key) Delete self[key]. [extrait de __delitem__.__doc__]
__eq__(self, value) Return self==value. [extrait de __eq__.__doc__]
__ge__(self, value) Return self>=value. [extrait de __ge__.__doc__]
__getitem__(self, key) Return self[key]. [extrait de __getitem__.__doc__]
__gt__(self, value) Return self>value. [extrait de __gt__.__doc__]
__iadd__(self, value) Implement self+=value. [extrait de __iadd__.__doc__]
__imul__(self, value) Implement self*=value. [extrait de __imul__.__doc__]
__le__(self, value) Return self<=value. [extrait de __le__.__doc__]
__lt__(self, value) Return self<value. [extrait de __lt__.__doc__]
__mod__(self, value) Return self%value. [extrait de __mod__.__doc__]
__mul__(self, value) Return self*value. [extrait de __mul__.__doc__]
__ne__(self, value) Return self!=value. [extrait de __ne__.__doc__]
__rmod__(self, value) Return value%self. [extrait de __rmod__.__doc__]
__rmul__(self, value) Return value*self. [extrait de __rmul__.__doc__]
__setitem__(self, key, value) Set self[key] to value. [extrait de __setitem__.__doc__]

Liste des méthodes

Toutes les méthodes Méthodes d'instance Méthodes statiques Méthodes dépréciées
Signature de la méthodeDescription
__alloc__ B.__alloc__() -> int [extrait de __alloc__.__doc__]
__getattribute__(self, name) Return getattr(self, name). [extrait de __getattribute__.__doc__]
__iter__(self) Implement iter(self). [extrait de __iter__.__doc__]
__len__(self) Return len(self). [extrait de __len__.__doc__]
__reduce__(self) Return state information for pickling. [extrait de __reduce__.__doc__]
__reduce_ex__(self, proto=0) Return state information for pickling. [extrait de __reduce_ex__.__doc__]
__repr__(self) Return repr(self). [extrait de __repr__.__doc__]
__sizeof__(self) Returns the size of the bytearray object in memory, in bytes. [extrait de __sizeof__.__doc__]
__str__(self) Return str(self). [extrait de __str__.__doc__]
append(self, item) Append a single item to the end of the bytearray. [extrait de append.__doc__]
capitalize B.capitalize() -> copy of B [extrait de capitalize.__doc__]
center(self, width, fillchar=b' ') Return a centered string of length width. [extrait de center.__doc__]
clear(self) Remove all items from the bytearray. [extrait de clear.__doc__]
copy(self) Return a copy of B. [extrait de copy.__doc__]
count B.count(sub[, start[, end]]) -> int [extrait de count.__doc__]
decode(self, /, encoding='utf-8', errors='strict') Decode the bytearray using the codec registered for encoding. [extrait de decode.__doc__]
endswith B.endswith(suffix[, start[, end]]) -> bool [extrait de endswith.__doc__]
expandtabs(self, /, tabsize=8) Return a copy where all tab characters are expanded using spaces. [extrait de expandtabs.__doc__]
extend(self, iterable_of_ints) Append all the items from the iterator or sequence to the end of the bytearray. [extrait de extend.__doc__]
find B.find(sub[, start[, end]]) -> int [extrait de find.__doc__]
fromhex(string) Create a bytearray object from a string of hexadecimal numbers. [extrait de fromhex.__doc__]
hex Create a str of hexadecimal numbers from a bytearray object. [extrait de hex.__doc__]
index B.index(sub[, start[, end]]) -> int [extrait de index.__doc__]
insert(self, index, item) Insert a single item into the bytearray before the given index. [extrait de insert.__doc__]
isalnum B.isalnum() -> bool [extrait de isalnum.__doc__]
isalpha B.isalpha() -> bool [extrait de isalpha.__doc__]
isascii B.isascii() -> bool [extrait de isascii.__doc__]
isdigit B.isdigit() -> bool [extrait de isdigit.__doc__]
islower B.islower() -> bool [extrait de islower.__doc__]
isspace B.isspace() -> bool [extrait de isspace.__doc__]
istitle B.istitle() -> bool [extrait de istitle.__doc__]
isupper B.isupper() -> bool [extrait de isupper.__doc__]
join(self, iterable_of_bytes) Concatenate any number of bytes/bytearray objects. [extrait de join.__doc__]
ljust(self, width, fillchar=b' ') Return a left-justified string of length width. [extrait de ljust.__doc__]
lower B.lower() -> copy of B [extrait de lower.__doc__]
lstrip(self, bytes=None) Strip leading bytes contained in the argument. [extrait de lstrip.__doc__]
maketrans(frm, to) Return a translation table useable for the bytes or bytearray translate method. [extrait de maketrans.__doc__]
partition(self, sep) Partition the bytearray into three parts using the given separator. [extrait de partition.__doc__]
pop(self, index=-1) Remove and return a single item from B. [extrait de pop.__doc__]
remove(self, value) Remove the first occurrence of a value in the bytearray. [extrait de remove.__doc__]
replace(self, old, new, count=-1) Return a copy with all occurrences of substring old replaced by new. [extrait de replace.__doc__]
reverse(self) Reverse the order of the values in B in place. [extrait de reverse.__doc__]
rfind B.rfind(sub[, start[, end]]) -> int [extrait de rfind.__doc__]
rindex B.rindex(sub[, start[, end]]) -> int [extrait de rindex.__doc__]
rjust(self, width, fillchar=b' ') Return a right-justified string of length width. [extrait de rjust.__doc__]
rpartition(self, sep) Partition the bytearray into three parts using the given separator. [extrait de rpartition.__doc__]
rsplit(self, /, sep=None, maxsplit=-1) Return a list of the sections in the bytearray, using sep as the delimiter. [extrait de rsplit.__doc__]
rstrip(self, bytes=None) Strip trailing bytes contained in the argument. [extrait de rstrip.__doc__]
split(self, /, sep=None, maxsplit=-1) Return a list of the sections in the bytearray, using sep as the delimiter. [extrait de split.__doc__]
splitlines(self, /, keepends=False) Return a list of the lines in the bytearray, breaking at line boundaries. [extrait de splitlines.__doc__]
startswith B.startswith(prefix[, start[, end]]) -> bool [extrait de startswith.__doc__]
strip(self, bytes=None) Strip leading and trailing bytes contained in the argument. [extrait de strip.__doc__]
swapcase B.swapcase() -> copy of B [extrait de swapcase.__doc__]
title B.title() -> copy of B [extrait de title.__doc__]
translate(self, table, /, delete=b'') Return a copy with each character mapped by the given translation table. [extrait de translate.__doc__]
upper B.upper() -> copy of B [extrait de upper.__doc__]
zfill(self, width) Pad a numeric string with zeros on the left, to fill a field of the given width. [extrait de zfill.__doc__]

Méthodes héritées de la classe object

__delattr__, __dir__, __format__, __hash__, __init_subclass__, __setattr__, __subclasshook__