On Tue, 2008-12-30 at 11:31 -0800, wx1...@gmail.com wrote:
> I have a list and would like to parse the list appending each list
> item to the end of a variable on a new line.
> 
> for instance
> 
> mylist = ['something\n', 'another something\n', 'something again\n']
> 
> then parse mylist to make it appear in my variable in this format:
> 
> myvar = """
> something
> another something
> something again"""
> 
> how would i go about setting a variable like this?

myvar = ''.join(mylist)

Though if you really want an "blank line" in the beginning you'll need
to prepend a '\n'

-a


--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to