f=open("hello.txt","r+")
f.read(5)
f.write("op")
f.close()
the text file contains the following text:
python my world heellll mine
According to me after opening the file in r+ mode the file pointer is in beginning(0). After f.read(5) it will reach after o.and then after f.write("op") it will "n " with "op" and the final output will be:
pythoopmy world heellll mine
but on running the program the output is:
python my world heellll mineop
Please help and explain why it is happening.