Illegal literal or not?

Mel Wilson mwilson at
Sat Jan 25 16:47:41 CET 2003

In article <_RfY9.862$d66.98244 at>,
"LJ & MT Lareau" <ljlmtlvt at> wrote:
>Is it possible to have Python produce the following literal output in the
>interactive mode.
>'"Let's try this!", they said.'
>If so what is the Python statement. I've tried several ways
>and can't seem to produce it.  Thanks for the help.

Just for weirdness' sake (there have been better answers)...

print "'" + '"' + "Let's try this!" + '"' + ', they said.' + "'"

print ''.join (["'", '"', "Let's try this!", '"', ', they said.', "'"])

        Regards.        Mel.

More information about the Python-list mailing list