Python strings question (vertical stack)

Farshid Lashkari no at spam.com
Tue Nov 20 14:40:59 EST 2007


dmitrey wrote:
> Hi all,
> I have some strings, let it be string1, string2, string3.
> 
> So how could String=
> """
> string1
> string2
> string3
> """
> 
> be obtained?
> 
> Thank you in advance, D.

If you just want the to add newlines between the strings then you can do 
the following:

String = '\\n'.join([string1,string2,string3])

-Farshid



More information about the Python-list mailing list