writing some lines after reading goes wrong on windows?

2006-04-27 Thread yichao.zhang
Hi all 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)

Re: writing some lines after reading goes wrong on windows?

2006-04-27 Thread harveysthomas
If you are opening a file for read and write access use rb+ or wb+. Seeking and subsequent read/write will then work fine. Without the b, Windows opens the file in its text mode. Don't seek on files opened in text mode. -- http://mail.python.org/mailman/listinfo/python-list