Re: [Tutor] File mode r+

2005-09-30 Thread Shitiz Bansal
Hi, Thats strange. Maybe me being on windows makes the diference. Here is the exact IDLE session to clarify: IDLE 1.1 No Subprocess >>> >>> file1=open("aa.txt",'r+') >>> file1.read() 'abcd\nefgh\nijkl\nmnop\nqrst\nuvwx\nyx12\n' >>> file1.close() >>> file1=open("aa.txt",'r+') >

Re: [Tutor] File mode r+

2005-09-27 Thread Shitiz Bansal
--- "Michael P. Reilly" <[EMAIL PROTECTED]> wrote: > On 9/24/05, Shitiz Bansal <[EMAIL PROTECTED]> wrote: > > > > Hi, > > > > How do i proceed if i am not sure about the number > of characters in the > > fist two lines and want to write in the third > line.is there a way to skip

Re: [Tutor] File mode r+

2005-09-24 Thread Shitiz Bansal
Hi, How do i proceed if i am not sure about the number of characters in the fist two lines and want to write in the third line.is there a way to skip two lines and write on the third?? Also could anyone explain why the readline() did not work. according to what i understand it should.   shitizbob

Re: [Tutor] File mode r+

2005-09-24 Thread bob
At 01:11 AM 9/24/2005, Shitiz Bansal wrote: >Hi, >I want to update a textfile using the r+ file mode. >contents of file: > >abcd >efgh >ijkl >mnop >qrst >uvwx >yx12 > >my scripts is: > >file1=open("aa.txt",'r+') Instead of readline, use skip to position the file to where you want to overwrite it.

[Tutor] File mode r+

2005-09-24 Thread Shitiz Bansal
Hi, I want to update a textfile using the r+ file mode. contents of file: abcd efgh ijkl mnop qrst uvwx yx12 my scripts is: file1=open("aa.txt",'r+') file1.readline() file1.readline() file1.write("1234\n") file1.close() This should replace the third line with 1234. However it does nothing. Mor