Feb-24-2017, 07:50 PM
I'm learning Python 3.6.
I figured out how to use the find() function to find a multiple hex byte string in a byte variable as follows:
If not, any suggestions on the easiest way to replace 7 consecutive bytes? I won't be inserting any bytes. Just replacing 7 consecutive bytes elsewhere in "byteData".
Thanks.
I figured out how to use the find() function to find a multiple hex byte string in a byte variable as follows:
with open("test 18.vf", "rb") as binaryFile: byteData = bytearray(binaryFile.read()) mx = 0 while mx != -1: mx = byteData.find(b'\x2A\x07\x3B\x1C\x14', mx) if mx != -1: Do somethingIs there a built-in function to change consecutive bytes in "byteData" that looks similar to the find function above?
If not, any suggestions on the easiest way to replace 7 consecutive bytes? I won't be inserting any bytes. Just replacing 7 consecutive bytes elsewhere in "byteData".
Thanks.