Hans-Peter Jansen wrote: > Hi Pythonistas, > > I need to convert ascii escapes into binary form, e.g.: > \f -> ^L > [EMAIL PROTECTED] -> [EMAIL PROTECTED]@ > > (rvalues in terminal representation) > > Any idea, how to do this most elegantly in python? > Do I really need to do a search n'replace orgy, combined with > regex for this task?
In [11]: s = '\\f' In [12]: s.decode('string_escape') Out[12]: '\x0c' -- Robert Kern [EMAIL PROTECTED] "In the fields of hell where the grass grows high Are the graves of dreams allowed to die." -- Richard Harter -- http://mail.python.org/mailman/listinfo/python-list