Home >>Python Built-in Functions >Python memoryview() Function
Python memoryview() function is used to return a memory view object from a given input object. It also allows direct read and write access to an object’s byte-oriented data without copying it.
Syntax:memoryview(obj)
Parameter | Description |
---|---|
obj | This parameter defines a Bytes object or a Bytearray object. |
x = memoryview(b"PHPTPOINT")
print(x)
print(x[0])
print(x[1])
x = memoryview(b"PHPTPOINT")
print(x)
print(x[0])
print(x[1])
print(x[2])
print(x[3])
print(x[4])
print(x[5])
print(x[6])
print(x[7])
print(x[8])