On 01/19/2012 10:04 AM, ADRIAN KELLY wrote:
guys,
its a text file i am writing to and when i write the first time its fine, i get
3 lines of input collected from a user and written to my text file, however if
i run the program again the next 3 lines begin at the end of the previous users
details. It works fine but starts from where the pointer left off. i dont
know how to solve this. where do i put the '\n'? to be honest the .join i
dont understand but otherwise it prints as a list e.g. ('name','age','etc')
Adrian
You top-posted. Please put your response *after* what you're quoting.
Anyway, since you're the one writing the original file, the problem is,
as I said, the file is broken. You don't write a trailing newline. So
the simplest fix is to add another write() call.
User_info.write("\n".join(Details))
User_info.write("\n")
The join command puts the specified text *between* the list elements,
but not after the last one.
--
DaveA
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor