How to insert element in specific index bytearray in Python

1 Answer

0 votes
ba = bytearray(b"abcd")
 
for item in ba:
    print(item)
 
ba.insert(1, 200)

print()

for item in ba:
    print(item)



    
    
'''
run:
  
97
98
99
100

97
200
98
99
100
     
'''

 



answered Sep 15, 2020 by avibootz

Related questions

...