Feb-22-2017, 11:04 PM
You can use bytearray instead of list (bytearray is mutable version of bytes and has some useful functions).
with open('data.data', 'rb') as f: data = bytearray(f.read()) data[:2] = 0, 0 with open('data.data', 'wb') as f: f.write(data)