Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.dougwise.org!news.le-studio75.com!news.univ-fcomte.fr!not-for-mail From: Laurent Claessens Newsgroups: comp.lang.python Subject: Re: What is this syntax ? Date: Sun, 19 Jun 2011 15:50:29 +0200 Organization: A poorly-installed InterNetNews site Lines: 32 Message-ID: <4DFDFEA5.9010204@gmail.com> References: <4dfdfc99$0$715$426a34cc@news.free.fr> NNTP-Posting-Host: soleil.univ-fcomte.fr Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-Trace: news.univ-fcomte.fr 1308491423 10861 194.57.84.1 (19 Jun 2011 13:50:23 GMT) X-Complaints-To: news@news.univ-fcomte.fr NNTP-Posting-Date: Sun, 19 Jun 2011 13:50:23 +0000 (UTC) To: candide User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.13) Gecko/20101208 Thunderbird/3.1.7 In-Reply-To: <4dfdfc99$0$715$426a34cc@news.free.fr> Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:7957 Le 19/06/2011 15:41, candide a écrit : > With Python 2.7 : > > >>> x="foo" > >>> print '"'+x+'"' > "foo" > >>> > > > What is this curious syntax on line 2 ? Where is it documented ? When you want to have an explicit double quote " in a string, you put in between single quote '. (and vice versa) So here you have the string '"' which is " then +x (add x) then +'"' Try also >>> print "'" ' >>> print "'" " Laurent