memoryview()
data = b'Hello, World!'
mem_view = memoryview(data)
print(mem_view) # Вывод: <memory at 0x7f8b7c8a9d30>data = bytearray(b'Hello, World!')
mem_view = memoryview(data)
mem_view[0] = ord('h') # Изменяем первый байт на 'h'
print(data) # Вывод: bytearray(b'hello, World!')data = b'Python is awesome!'
mem_view = memoryview(data)
substring = mem_view[7:15].tobytes()
print(substring) # Вывод: b'awesome!'Последнее обновление