simple string question

D'Arcy J.M. Cain darcy at druid.net
Mon Sep 7 10:37:18 EDT 2009


On Mon, 7 Sep 2009 15:29:23 +1000
"jwither" <jwither at sxder4kmju.com> wrote:
> Given a string (read from a file) which contains raw escape sequences, 
> (specifically, slash n), what is the best way to convert that to a parsed 
> string, where the escape sequence has been replaced (specifically, by a 
> NEWLINE token)?

I don't know what your actual requirement is but maybe this fits:

exec("print '%s'" % x)

-- 
D'Arcy J.M. Cain <darcy at druid.net>         |  Democracy is three wolves
http://www.druid.net/darcy/                |  and a sheep voting on
+1 416 425 1212     (DoD#0082)    (eNTP)   |  what's for dinner.



More information about the Python-list mailing list