Function Details: memoryview

Description


Creates a memory view object from a bytes-like object.


Extended Description


The memoryview() function creates a memory view object from a bytes-like object. It allows you to access the internal data of an object that supports the buffer protocol without copying the object's contents. This can be useful for efficient manipulation of large data structures.


Read More about memoryview from Python Documentation

Function Signature


memoryview(obj: Union[bytes, bytearray, array.array]) -> memoryview

Module: builtins

Class: memoryview

Parameters



Parameter List


  • obj: Union[bytes, bytearray, array.array]

Return


Returns a memoryview object that allows direct access to an object's memory.


Return Type


memoryview

Output

Explanation

This example shows basic operations with a memoryview created from a bytes object.