<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Tahoma
}
--></style></head>
<body class='hmmessage'><div dir='ltr'>
guys,<BR>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 <STRONG>.join </STRONG>i dont understand but otherwise it prints as a list e.g. ('name','age','etc')<BR><STRONG>Adrian </STRONG><BR>
<BR>
<DIV>
<DIV id=SkyDrivePlaceholder></DIV>> Date: Thu, 19 Jan 2012 09:42:45 -0500<BR>> Subject: Re: [Tutor] appending to a file on a new line<BR>> From: joel.goldstick@gmail.com<BR>> To: kellyadrian@hotmail.com<BR>> CC: tutor@python.org<BR>> <BR>> On Thu, Jan 19, 2012 at 9:32 AM, ADRIAN KELLY <kellyadrian@hotmail.com> wrote:<BR>> > Hi everyone,<BR>> > is there an easy way to write to a file (that already exists with data<BR>> > contained) on a new line. I understand that the file pointer appends where<BR>> > it left off but how do i write to the next line or even skip a line if<BR>> > possible?<BR>> ><BR>> > User_info=open("C:\\Documents and<BR>> > Settings\\akelly\\Desktop\\details.txt",'a')<BR>> > User_info.write("\n".join(Details))<BR>> ><BR>> ><BR>> > all the best,<BR>> > Adrian<BR>> ><BR>> > _______________________________________________<BR>> > Tutor maillist - Tutor@python.org<BR>> > To unsubscribe or change subscription options:<BR>> > http://mail.python.org/mailman/listinfo/tutor<BR>> ><BR>> What you wrote looks fine. When you open a file to append, it does<BR>> just that with the write method.<BR>> <BR>> You can learn more here<BR>> http://docs.python.org/tutorial/inputoutput.html#methods-of-file-objects<BR>> <BR>> When you run your code what happens?<BR>> <BR>> <BR>> -- <BR>> Joel Goldstick<BR></DIV>                                            </div></body>
</html>