On 11/29/2011 02:24 PM, Mic wrote:


<SNIP>

Actually, I nearly know how do to solve this problem. I just have one problem. Can I use writeline() to write text into line 3 or line 5 for example? Say that I want to write the text "hi" into line five of a text file, can I do this using writeline(), if so, how ?


This is why you should stick to one thread for one problem. Read my reply on your original thread. You cannot safely update intermediate lines in a text file unless you're positive they're the same length. And even then, using seek() to position yourself is fraught with problems, especially if you have to work on Windows.

Either use a binary file, or write the whole file out each time.

--

DaveA

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to