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 
 

> Date: Thu, 19 Jan 2012 09:42:45 -0500
> Subject: Re: [Tutor] appending to a file on a new line
> From: joel.goldst...@gmail.com
> To: kellyadr...@hotmail.com
> CC: tutor@python.org
> 
> On Thu, Jan 19, 2012 at 9:32 AM, ADRIAN KELLY <kellyadr...@hotmail.com> wrote:
> > Hi everyone,
> > is there an easy way to write to a file (that already exists with data
> > contained) on a new line.  I understand that the file pointer appends where
> > it left off but how do i write to the next line or even skip a line if
> > possible?
> >
> > User_info=open("C:\\Documents and
> > Settings\\akelly\\Desktop\\details.txt",'a')
> > User_info.write("\n".join(Details))
> >
> >
> > all the best,
> > Adrian
> >
> > _______________________________________________
> > Tutor maillist  -  Tutor@python.org
> > To unsubscribe or change subscription options:
> > http://mail.python.org/mailman/listinfo/tutor
> >
> What you wrote looks fine. When you open a file to append, it does
> just that with the write method.
> 
> You can learn more here
> http://docs.python.org/tutorial/inputoutput.html#methods-of-file-objects
> 
> When you run your code what happens?
> 
> 
> -- 
> Joel Goldstick
                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to