Loading...
Python

bytearray Data Type

bytearray is same as byte data type except its elements can be modified.
Example 1:
x=[10,20,30,40,]
for i in b : print(i)
10
20
30
40
b[0]=100
for i in b : print(i)
100
20
30
40
Example 2:
>>>x=[10,256]
>>>b=bytearray(x)
ValueError: byte must be in range(0,256)

Leave a Reply

Your email address will not be published. Required fields are marked *