On Sun, Jun 19, 2011 at 11:41 PM, candide <candide@free.invalid> wrote: > With Python 2.7 : > >>>> x="foo" >>>> print '"'+x+'"' > "foo" >>>>
As Laurent posted, it's simply a literal double-quote character, enclosed in single quotes. But for making a quoted string, this isn't reliable (what if there's a double quote in the string itself?), so you may want to try repr() which makes a theoretically evalable string: >>> x="foo" >>> print repr(x) 'foo' >>> x=raw_input() "Ha ha! 'Tis mine!", he said. >>> print repr(x) '"Ha ha! \'Tis mine!", he said.' In this instance, repr chose to use single quotes, but the same applies. Chris Angelico -- http://mail.python.org/mailman/listinfo/python-list