Fonction Python memoryview()
Exemple
Créez et imprimez un objet 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])
Définition et utilisation
La memoryview()
fonction renvoie un objet de vue mémoire à partir d'un objet spécifié.
Syntaxe
memoryview(obj)
Valeurs des paramètres
Parameter | Description |
---|---|
obj | A Bytes object or a Bytearray object. |