[issue45076] open "r+" problem

2021-09-01 Thread otn
otn added the comment: It works correct for ver2.6, and also "rb+". Buffering procsess should work the same as those case. -- ___ Python tracker ___ __

[issue45076] open "r+" problem

2021-09-01 Thread Zachary Ware
Zachary Ware added the comment: Usage questions like this are better suited to the Users category at https://discuss.python.org/c/users/7 or the python-l...@python.org mailing list. The write is buffered. If you want it to be written before you read, add `f.flush()` after the write; `f.tell

[issue45076] open "r+" problem

2021-09-01 Thread otn
New submission from otn : For opened file as "r+", even if write() then readline(), readline() is executed first. When add tell() after write(), it works correctly. == data1 = "aa\nbb\ncc\n" data2 = "xx\n" with open("data.txt","w") as f: f.write(da