i want replace a specific part of file by bytes, here's an ugly image to explain what i want to achieve:-
i tried to do it with this code
f=open('a.txt')
f.seek(250, os.SEEK_SET)
print(f.read(750))
it works fine, but it only reads the file, not actually writes to the file. i tried to use this code
f=open('a.txt')
f.seek(250, os.SEEK_SET)
print(f.write('data', 750))
but write
only takes 1 argument, so i can't use write
command.
are there any methods i can achieve this in python?