What is this syntax ?

Noah Hall enalicho at gmail.com
Sun Jun 19 09:58:41 EDT 2011


On Sun, Jun 19, 2011 at 2:41 PM, candide <candide at free.invalid> wrote:
> With Python 2.7 :
>
>>>> x="foo"
>>>> print '"'+x+'"'
> "foo"

> What is this curious syntax on line 2 ? Where is it documented ?

Just to make it clear to you what is happening -

>>> x = "foo"
>>> print ' " ' + x + ' " '
 " foo "
>>>

Anyway, it's documented here -
http://docs.python.org/tutorial/introduction.html#strings



More information about the Python-list mailing list