ncf wrote: > I know I've seen this somewhere before, but does anyone know what the > function to escape a string is? (i.e., encoding newline to "\n" and a > chr(254) to "\xfe") (and visa-versa)
In [1]: s = "foo\n\xfe" In [2]: s.encode("string_escape") Out[2]: 'foo\\n\\xfe' In [3]: repr(s)[1:-1] Out[3]: 'foo\\n\\xfe' -- 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