[Tutor] File mode r+

Shitiz Bansal shitizb at yahoo.com
Sat Sep 24 22:44:31 CEST 2005


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.



bob <bgailer at alum.rpi.edu> wrote:
At 01:11 AM 9/24/2005, Shitiz Bansal wrote:
>I want to update a textfile using the r+ file mode.
>contents of file:
>my scripts is:

>>Instead of readline, use skip to position the file to where you want to 
>>overwrite it.

>This should replace the third line with 1234.
>However it does nothing.
>Moreover the script:
>does replace the first line with 1234.
>could anyone explain what is happening?
>Do You Yahoo!?
>Tired of spam? Yahoo! Mail has the best spam protection around
>Tutor maillist - Tutor at python.org

Yahoo! for Good
 Click here to donate to the Hurricane Katrina relief effort. 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20050924/3eb488e5/attachment.html

More information about the Tutor mailing list