[Tutor] Append mode dilemma

biboy mendz bibsmendez at gmail.com
Wed Dec 9 20:38:06 CET 2009


-- 
Regards,
bibs M.

Host/Kernel/OS  "cc000002695" running Linux 2.6.31-5.slh.4-sidux-686 
[sidux 2009-02 Αιθήρ - kde-full - (200907141427) ]
www.sidux.com



Albert Sweigart wrote:
> Your problem is on this line:
>
> fobj.write('\n'.join(all))
>
> This puts a newline in between each line in "all", but not at the end.
> The fix is simple:
>
> fobj.write('\n'.join(all) + '\n')
>
> This will make sure that the last line has a newline at the end of it,
> so that when you later append data, it will appear on a fresh line.
>
> -Al Sweigart
> You should check out my free beginner's Python book, "Invent Your Own
> Computer Games with Python"
> http://inventwithpython.com
>   

My bad on the print line addon. It doesnt work as expected.

Adding '\n' at the join call function solved my problem. Thank you guys 
very much. Have a lot more of reading up to do :-)
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> To unsubscribe or change subscription options:
> http://mail.python.org/mailman/listinfo/tutor
>
>   


More information about the Tutor mailing list