memoryview()

Built-in FunctionPython 2.7+Advanced

Creates a memory view object for binary data without copying

Quick Info

Documentation
Official Docs
Python Version
2.7+

Learn by Difficulty

Quick Example

python
data = bytearray(b"hello")
mv = memoryview(data)
print(mv[0])
print(bytes(mv[1:3]))

memoryview() is a built-in function that creates a memory view object for binary data without copying.

Try in Playground

Tags

builtinfunctioncoredatatypebinarybufferperformance

Related Items