According to python documentation r+ can be used to read and write and the stream is positioned at the beginning of the file.But when I run this code, the code does not show the first few letter and shows "erwhateverwhatever " when I run it several times. I have checked the text file and whateverwhateverwhatever is wirtten after running the code three times. But I see "erwhateverwhatever " for read. Anyone knows the reason?
file=open('test.txt', 'r+')
file.write('whatever')
print(file.read())
file.close()