I have a large text file and I know the positions of the parts of the code that I would like to change. I am trying to do something similar to this:
infile = open('file.txt', 'rb')
infile.seek(start_position)
text_lenght = end_position - start_position
print(infile.read(text_lenght).upper(), file = infile)
The file is supposed to be modified in place and overwrite the previous text file. Is there a way to do this?
Hope I explained myself clear enough.