convert ascii escapes into binary form

Hans-Peter Jansen hpj at urpla.net
Wed Jul 20 12:30:36 EDT 2005


Hi Pythonistas,

I need to convert ascii escapes into binary form, e.g.:
\f -> ^L
\033@\x1bk\000 -> ^[@^[k^@

(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?

TIA,
Pete





More information about the Python-list mailing list