I can not write anything if I have read something.
the code as:
Python 2.4.3 (#69, Apr 11 2006, 15:32:42) [MSC v.1310 32 bit (Intel)]
on win32
IDLE 1.1.3
a=open('d:\\a','r+')
a <open file 'd:\a', mode 'r+' at 0x00A147B8> a.read() '11\n22\n33\n' a.seek(0)
a.read(1) '1' a.write("a")
a.seek(0)
a.read() '11\n22\n33\n' # it fails to write after reading
a.seek(0)
a.write("a")
a.seek(0)
a.read() 'a1\n22\n33\n' # it writes fine at the beginning of
the file
it fails to write "a". but on my debian box, it works fine.
the code on debian as:
Python 2.3.5 (#2, Sep 4 2005, 22:01:42)
[GCC 3.3.5 (Debian 1:3.3.5-13)] on linux2
Type "help", "copyright", "credits" or "license" for more information. a=open('/a','r+')
a <open file '/a', mode 'r+' at 0x4019dd60> a.read() '11\n22\n33\n' a.seek(0)
a.read(1) '1' a.write("a")
a.seek(0)
a.read() '1a\n22\n33\n'
What's wrong here? is this a bug on windows platform.