[Tutor] Quoting trouble

Marilyn Davis marilyn at deliberate.com
Fri Jan 20 20:02:54 CET 2006


Dear Tutors,

I'm having a problem and going around in circles.  I'm on Python 2.4.1.

This odd address line comes in email:  

>>> line = '''"ma >> \"marilyn at maildance.com\"" <marilyn at maildance.com>'''

It makes sense to me, and to the MTA.  I want to use it to create a
variable:

>>> exec('h_to = %s' % line)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "<string>", line 1
    h_to = "ma >> "marilyn at maildance.com"" <marilyn at maildance.com>
                         ^
SyntaxError: invalid syntax

So, how do I keep the \" in there?

I've tried a bunch of things but can't find anything that works.

Heeeeeeeeeeelp.  Please.

Thank you.

Marilyn Davis




More information about the Tutor mailing list