Re: why writing list to file puts each item from list on seperate line?
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

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

From: limodou <limodou@gmail.com>
Date: Sat Dec 31 2005 - 05:50:32 CET

30 Dec 2005 20:44:29 -0800, homepricemaps@gmail.com <homepricemaps@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
Received on Tue Jan 3 03:28:29 2006