Participer au site avec un Tip
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 » Python 3.11.3

Classe « bytes »

Informations générales

Héritage

builtins.object
    builtins.bytes

Définition

class bytes(builtins.object):

help(bytes)

bytes(iterable_of_ints) -> bytes
bytes(string, encoding[, errors]) -> bytes
bytes(bytes_or_buffer) -> immutable copy of bytes_or_buffer
bytes(int) -> bytes object of size given by the parameter initialized with null bytes
bytes() -> empty bytes object

Construct an immutable array of bytes from:
  - an iterable yielding integers in range(256)
  - a text string encoded using the specified encoding
  - 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__]
__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__]
__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__]

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
__bytes__(self) Convert this value to exact type bytes. [extrait de __bytes__.__doc__]
__getattribute__(self, name) Return getattr(self, name). [extrait de __getattribute__.__doc__]
__getnewargs__
__hash__(self) Return hash(self). [extrait de __hash__.__doc__]
__iter__(self) Implement iter(self). [extrait de __iter__.__doc__]
__len__(self) Return len(self). [extrait de __len__.__doc__]
__repr__(self) Return repr(self). [extrait de __repr__.__doc__]
__str__(self) Return str(self). [extrait de __str__.__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__]
count B.count(sub[, start[, end]]) -> int [extrait de count.__doc__]
decode(self, /, encoding='utf-8', errors='strict') Decode the bytes 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__]
find B.find(sub[, start[, end]]) -> int [extrait de find.__doc__]
fromhex(string) Create a bytes object from a string of hexadecimal numbers. [extrait de fromhex.__doc__]
hex Create a string of hexadecimal numbers from a bytes object. [extrait de hex.__doc__]
index B.index(sub[, start[, end]]) -> int [extrait de index.__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 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 bytes into three parts using the given separator. [extrait de partition.__doc__]
removeprefix(self, prefix) Return a bytes object with the given prefix string removed if present. [extrait de removeprefix.__doc__]
removesuffix(self, suffix) Return a bytes object with the given suffix string removed if present. [extrait de removesuffix.__doc__]
replace(self, old, new, count=-1) Return a copy with all occurrences of substring old replaced by new. [extrait de replace.__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 bytes 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 bytes, 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 bytes, using sep as the delimiter. [extrait de split.__doc__]
splitlines(self, /, keepends=False) Return a list of the lines in the bytes, 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__, __getstate__, __init_subclass__, __reduce__, __reduce_ex__, __setattr__, __sizeof__, __subclasshook__