Message258618
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. |
|
Date |
User |
Action |
Args |
2016-01-19 19:38:15 | fornax | set | recipients:
+ fornax, pitrou, vstinner, benjamin.peterson, stutzbach, Zero, docs@python, serhiy.storchaka, eryksun, steve.dower |
2016-01-19 19:38:15 | fornax | set | messageid: <1453232295.89.0.586887454079.issue26158@psf.upfronthosting.co.za> |
2016-01-19 19:38:15 | fornax | link | issue26158 messages |
2016-01-19 19:38:15 | fornax | create | |
|