Python memoryview()関数
例
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])
定義と使用法
このmemoryview()
関数は、指定されたオブジェクトからメモリビューオブジェクトを返します。
構文
memoryview(obj)
パラメータ値
Parameter | Description |
---|---|
obj | A Bytes object or a Bytearray object. |