What is the difference between bytearray
and for example, a list
or tuple
?
As the name suggests, bytearray
must be an array
that carries byte
objects.
In python, it seems that bytes
and str
are treated equally
>>> bytes
<type 'str'>
So, what is the difference?
Also, if you print a bytearray
, the result is pretty weird
>>> v = bytearray([200, 201])
>>> print v
ÈÉ
It seems that it transforms the integer in chr(integer)
, is that right? What is the use of a bytearray
then?