I have 1 bitsInfo string:
bitsInfo="0100001111110001"
and 1 array bitReplace which includes subarray:
bitReplace=[["1","5","00000"],["8","11","0000"]]
The first element of the subarray is startbit location and the second element is the endbit location.
The goal of the script is to replace the bitsInfo string (with the third element of subarray) base on startbit and endbit information.
The expected result should be
bitsFinal="0000001100000001"
I have tried this method:
for bits in bitReplace:
bitsFinal = bits[:int(bits[0])+bits[2]+ bits[int(bits[1]+1:]
This method doesn't really work. May I know what went wrong?