On this page
uuid.bytes_
Up: uuid | Next: uuid.Enum
Rel: uuid.Enum, uuid.getnode, uuid.int_, uuid.main
Ref: docs.python.org — uuid.bytes_
Tags: #public #python3 #stdlib #uuid
Import
import uuid
from uuid import bytes_
Signature & Overview
uuid.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
Methods & Attributes
bytes_.capitalize(self, /)— Return a copy of B with only its first character capitalized (ASCII) and the rest lower-cased.bytes_.center(self, width, fillchar=b' ', /)— Return a centered string of length width.bytes_.count(...)— Return the number of non-overlapping occurrences of subsection 'sub' in bytes B[start:end].bytes_.decode(self, /, encoding='utf-8', errors='strict')— Decode the bytes using the codec registered for encoding.bytes_.endswith(...)— Return True if the bytes ends with the specified suffix, False otherwise.bytes_.expandtabs(self, /, tabsize=8)— Return a copy where all tab characters are expanded using spaces.bytes_.find(...)— Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].bytes_.fromhex(string, /)— Create a bytes object from a string of hexadecimal numbers.bytes_.hex(...)— Create a string of hexadecimal numbers from a bytes object.bytes_.index(...)— Return the lowest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].bytes_.isalnum(self, /)— Return True if all characters in B are alphanumeric and there is at least one character in B, False otherwise.bytes_.isalpha(self, /)— Return True if all characters in B are alphabetic and there is at least one character in B, False otherwise.bytes_.isascii(self, /)— Return True if B is empty or all characters in B are ASCII, False otherwise.bytes_.isdigit(self, /)— Return True if all characters in B are digits and there is at least one character in B, False otherwise.bytes_.islower(self, /)— Return True if all cased characters in B are lowercase and there is at least one cased character in B, False otherwise.bytes_.isspace(self, /)— Return True if all characters in B are whitespace and there is at least one character in B, False otherwise.bytes_.istitle(self, /)— Return True if B is a titlecased string and there is at least one character in B, i.e. uppercase characters may only follow uncased characters and lowercase characters only cased ones. Return Falsebytes_.isupper(self, /)— Return True if all cased characters in B are uppercase and there is at least one cased character in B, False otherwise.bytes_.join(self, iterable_of_bytes, /)— Concatenate any number of bytes objects.bytes_.ljust(self, width, fillchar=b' ', /)— Return a left-justified string of length width.bytes_.lower(self, /)— Return a copy of B with all ASCII characters converted to lowercase.bytes_.lstrip(self, bytes=None, /)— Strip leading bytes contained in the argument.bytes_.maketrans(frm, to, /)— Return a translation table usable for the bytes or bytearray translate method.bytes_.partition(self, sep, /)— Partition the bytes into three parts using the given separator.bytes_.removeprefix(self, prefix, /)— Return a bytes object with the given prefix string removed if present.bytes_.removesuffix(self, suffix, /)— Return a bytes object with the given suffix string removed if present.bytes_.replace(self, old, new, count=-1, /)— Return a copy with all occurrences of substring old replaced by new.bytes_.rfind(...)— Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].bytes_.rindex(...)— Return the highest index in B where subsection 'sub' is found, such that 'sub' is contained within B[start,end].bytes_.rjust(self, width, fillchar=b' ', /)— Return a right-justified string of length width.bytes_.rpartition(self, sep, /)— Partition the bytes into three parts using the given separator.bytes_.rsplit(self, /, sep=None, maxsplit=-1)— Return a list of the sections in the bytes, using sep as the delimiter.bytes_.rstrip(self, bytes=None, /)— Strip trailing bytes contained in the argument.bytes_.split(self, /, sep=None, maxsplit=-1)— Return a list of the sections in the bytes, using sep as the delimiter.bytes_.splitlines(self, /, keepends=False)— Return a list of the lines in the bytes, breaking at line boundaries.bytes_.startswith(...)— Return True if the bytes starts with the specified prefix, False otherwise.bytes_.strip(self, bytes=None, /)— Strip leading and trailing bytes contained in the argument.bytes_.swapcase(self, /)— Return a copy of B with uppercase ASCII characters converted to lowercase ASCII and vice versa.bytes_.title(self, /)— Return a titlecased version of B, i.e. ASCII words start with uppercase characters, all remaining cased characters have lowercase.bytes_.translate(self, table, /, delete=b'')— Return a copy with each character mapped by the given translation table.
Usage
import uuid
# Keyword argument / alias used internally; pass bytes= to uuid.UUID(bytes=raw16)
assert isinstance(uuid.UUID(bytes=b'\x00' * 16), uuid.UUID)
Gotchas
- Pass
uuid.UUID(bytes=b16)for 16-byte binary UUIDs.
REPL Inspect
from uuid import bytes_
help(bytes_)
Linked from
- tuts/python3/stdlib_module/uuid
- tuts/python3/stdlib_module/uuid/Enum
- tuts/python3/stdlib_module/uuid/getnode
- tuts/python3/stdlib_module/uuid/int_
- tuts/python3/stdlib_module/uuid/main
- tuts/python3/stdlib_module/uuid/SafeUUID
- tuts/python3/stdlib_module/uuid/UUID
- tuts/python3/stdlib_module/uuid/uuid1
- tuts/python3/stdlib_module/uuid/uuid3
- tuts/python3/stdlib_module/uuid/uuid4
- tuts/python3/stdlib_module/uuid/uuid5
- tuts/python3/stdlib_module/uuid/uuid6
- tuts/python3/stdlib_module/uuid/uuid7
- tuts/python3/stdlib_module/uuid/uuid8
Related notes
- tuts/python3/stdlib_module/uuid/Enum Linked here; links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/getnode Linked here; links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/int_ Linked here; links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/main Linked here; links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/UUID Linked here; links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/SafeUUID links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/uuid1 links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/uuid3 links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/uuid4 links to this page; shared tags: #stdlib, #uuid
- tuts/python3/stdlib_module/uuid/uuid5 links to this page; shared tags: #stdlib, #uuid