-->bytearray is exactly same as bytes data type except that its elements can be modified.
Example:
>>>x=[10,20,30,40]
>>>b=bytearray(x)
>>>for i in b: print(i)#10 20 30 40
>>>b[0]=100
>>>for i in b: print(i)#100 20 30 40
Example:
>>> x =[10,256]
>>> b= bytearray(x)
ValueError: byte must be in range(0,256)
No comments:
Post a Comment
Thank you Very Much.For Given Comment