New submission from Adam Wasik: >>> file = open(r"C:\adam.txt","r+") >>> file.read() 'TEXT TEXT TEXT TEXT TEXT TEXT TEXT\nTEXT TEXT TEXT TEXT TEXT TEXT TEXT\nTEXT TE XT TEXT TEXT TEXT TEXT TEXT\nTEXT TEXT TEXT TEXT TEXT TEXT TEXT\nTEXT TEXT TEXT TEXT TEXT TEXT TEXT\nTEXT TEXT TEXT TEXT TEXT TEXT TEXT' >>> file.seek(0,0) 0 >>> file.read(1) 'T' >>> file.tell() 1 >>> file.write("NEW") 3 >>> file.tell() # Why 217 rather than 4. Text is added at the end file 217 >>>
---------- components: IO messages: 256756 nosy: Adam Wasik priority: normal severity: normal status: open title: file.write() after file.read() adds text to the end of the file versions: Python 3.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue25915> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com