[Tutor] output formatting

W W srilyk at gmail.com
Sat Apr 25 13:39:44 CEST 2009


On Fri, Apr 24, 2009 at 10:57 PM, Matt Domeier <domeier at umich.edu> wrote:

> Hello,
>
> I have a series of lists that I need to output into files with a specific
> format. Specifically, I need to have line breaks after each entry of the
> list, and I need to do away with the ['..'] that accompany the data after I
> transform the list into a string. Can I simply append a '\n' to the end of
> all the list entries in order to enact line breaks?
>

Is this what you're looking for?

In [3]: print '\n'.join(['the quick brown fox', 'jumps over', 'the lazy
dog'])
the quick brown fox
jumps over
the lazy dog

HTH,
Wayne
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090425/ef03d2b5/attachment.htm>


More information about the Tutor mailing list