Funkce memoryview() Pythonu
Příklad
Vytvořte a vytiskněte objekt memoryview:
x = memoryview(b"Hello")
print(x)
#return the Unicode of the
first character
print(x[0])
#return the Unicode of the second
character
print(x[1])
Definice a použití
Funkce memoryview()
vrací objekt zobrazení paměti ze zadaného objektu.
Syntax
memoryview(obj)
Hodnoty parametrů
Parameter | Description |
---|---|
obj | A Bytes object or a Bytearray object. |