English documents:
class memoryview(obj)
-
memoryviewObjects allow Python code to access the internal data of a object that supports the buffer protocol without copying.
-
Create A that
memoryview references obj. obj must support the buffer protocol. Built-in objects that support the buffer protocol include bytes and bytearray .
Description
1. Function function returns the Memory View object, which is actually the constructor of the memory viewing object (Momory view).
2. The so-called memory viewing object, refers to the support buffer protocol data packaging, without the need to copy objects based on allowing Python code access.
3. The objects in the Python built-in object that support the buffer protocol are bytes and ByteArray.
>>> v = memoryview (b'abcefg')>>> v[1]98>>> V[-1]103>>> v[1:4]<memory at 0x7f3ddc9f4350>>>> bytes (v[1:4]) b ' BCE '
Python built-in function (--memoryview)