Using repr() with escape sequences

nummertolv nummertolv at gmail.com
Mon Feb 27 03:57:06 EST 2006


myString = "bar\foo\12foobar"
print repr(myString)

My "problem" was that I wanted to know if there is a way of printing
"unraw" strings like myString so that the escape characters are written
like a backslash and a letter or number. My understanding was that
repr() did this and it does in most cases (\n and \t for instance). In
the cases of \a,\b,\f and \v however, it prints hexadecimal numbers.
But I guess I'll just have to live with that and as you point out, it
doesn't have to be a problem anyway.




More information about the Python-list mailing list