Robert Kern wrote:

> 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'

That did the trick, thanks a lot, Peter. Unfortunately, on the 
target system, there's still python 2.0 running :-( Looks like 
I've to bite the apple..

Pete
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to