Python strings question (vertical stack)

James Matthews nytrokiss at gmail.com
Tue Nov 20 23:04:00 CET 2007


I would say to split it by the newline!

On Nov 20, 2007 10:59 PM, John Machin <sjmachin at lexicon.net> wrote:

> On Nov 21, 7:15 am, Farshid Lashkari <n... at spam.com> wrote:
> > J. Clifford Dyer wrote:
> > > I think you mean '\n'.join([string1,string2,string3])
> >
> > > You actually do want the \ to do its thing in this case.
> >
> > Yeah, my brain must still be asleep. Thanks for waking it up :)
>
> You're not alone :-)
>
> >>> a = """
> ... x
> ... y
> ... z
> ... """
> >>> a
> '\nx\ny\nz\n'
> >>> '\n'.join(['x', 'y', 'z'])
> 'x\ny\nz'
> >>>
> --
> http://mail.python.org/mailman/listinfo/python-list
>



-- 
http://search.goldwatches.com/
http://www.jewelerslounge.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20071120/098716b9/attachment.html>


More information about the Python-list mailing list