Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

The Bytearray Type

# Cast bytes to bytearray
mutable_bytes = bytearray(b'x00x0F')

# Bytearray allows modification
mutable_bytes[0] = 255
mutable_bytes.append(255)
print(mutable_bytes)

# Cast bytearray back to bytes
immutable_bytes = bytes(mutable_bytes)
print(immutable_bytes)
Source by www.devdungeon.com #
 
PREVIOUS NEXT
Tagged: #The #Bytearray #Type
ADD COMMENT
Topic
Name
1+8 =