How to append values to bytearray in Python

1 Answer

0 votes
arr = bytearray()

arr.append(0)
arr.append(1)
arr.append(2)
arr.append(3)
arr.append(4)

print(arr)

'''
run:

bytearray(b'\x00\x01\x02\x03\x04')

'''

 



answered Sep 7, 2018 by avibootz

Related questions

1 answer 160 views
2 answers 188 views
188 views asked Apr 24, 2021 by avibootz
1 answer 138 views
138 views asked Aug 28, 2020 by avibootz
2 answers 185 views
1 answer 195 views
1 answer 149 views
1 answer 169 views
...