Built-in Functions
memoryview()
Create a view that can access binary data without copying it.
memoryview(object)
memoryview() lets you work with bytes or a bytearray through a view of the same data.
This is an advanced tool, but a view of a bytearray can change the original data.
Parameters
| Name | Description |
|---|---|
| object | An object that provides binary data, such as bytes or bytearray. |
Returns
A memoryview object.
Try it
Run it and change it
data = bytearray([65, 66]) view = memoryview(data) view[0] = 90 print(list(data))