[issue38935] File modes with '+' character does not give expected output

2019-11-27 Thread Steven D'Aprano
Steven D'Aprano added the comment: This is expected behaviour. You read from the position of the file pointer, not the beginning of the file, so after writing to to the file, you have to use the seek() method to return to the beginning if you want to read what you just wrote.

[issue38935] File modes with '+' character does not give expected output

2019-11-27 Thread Anmol Kejriwal
Anmol Kejriwal added the comment: According to the doc, https://docs.python.org/3/library/functions.html#open The expected output for r+ mode in the program mentioned earlier should be: 123This is python. This is an easy language. Anyone can learn this easily --

[issue38935] File modes with '+' character does not give expected output

2019-11-27 Thread Anmol Kejriwal
New submission from Anmol Kejriwal : The file modes a+, r+, w+ should read and write both. But a+ and w+ modes are not reading anything from the file. The RUN for the program is successful, but there is no output from the program. Below is a simple program: file=open("abcd.txt","w+")