why writing list to file puts each item from list on seperate line?

limodou limodou at gmail.com
Fri Dec 30 23:50:32 EST 2005


30 Dec 2005 20:44:29 -0800, homepricemaps at gmail.com <homepricemaps at gmail.com>:
> i want them to be on the same line when they are written to the file.
> right now they are written like this:
>
> food
> price
> store
>
> i want them to be written like this
>
> food price store
>
> how do i do that?
>

 >>> print ' '.join(['food', 'price', 'store'])

os.linesep represents newline.


--
I like python!
My Blog: http://www.donews.net/limodou
NewEdit Maillist: http://groups.google.com/group/NewEdit



More information about the Python-list mailing list