If you have a string and want to perform backslash-substitution on it, use python2.3's "string_escape" codec. Two examples: >>> s = "\\n" >>> s '\\n' >>> s.decode("string_escape") '\n' >>> "\x30" '0' >>> "\\x30" '\\x30' >>> "\\x30".decode("string_escape") '0' You can remove the trailing newline this way: if s.endswith("\n"): s = s[:-1] Jeff