Fornax added the comment: Another surprising result:
>>> open('temp.txt', 'w').write('ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n') 32 >>> f = open('temp.txt', 'r+') >>> f.write('test') 4 >>> f.close() >>> open('temp.txt').read() 'testE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n' >>> open('temp.txt', 'w').write('ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\n') 32 >>> f = open('temp.txt', 'r+') >>> f.write('test') 4 >>> f.read(1) 'A' >>> f.close() >>> open('temp.txt').read() 'ABCDE\nFGHIJ\nKLMNO\nPQRST\nUVWXY\nZ\ntest' The position of the write in the file depends on whether or not there is a subsequent read. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue26158> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com