Parsing strings (\n and \\)

rzed Dick.Zantow at lexisnexis.com
Tue Jun 25 12:09:31 EDT 2002


"Fredrik Lundh" <fredrik at pythonware.com> wrote in message
news:lt0S8.45025$n4.10623651 at newsc.telia.net...
> François Pinard wrote:
>
> > A simple avenue is to get Python itself to evaluate the string as
a constant
> > (you ensure this by removing evaluation context).  Something like
this:
> >
> >     PARSED = eval(UNPARSED, {}, {})
>
> >>> UNPARSED = "__import__('os').system('echo dream on!')"
> >>> PARSED = eval(UNPARSED, {}, {})
> dream on!
>

Even if you use
from __far_future__ import * ?






More information about the Python-list mailing list