Python Forum

Full Version: ascii() (repr() in py2)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
the ascii() function in py3 (repr() in py2) converts only 3 ASCII control characters to mnemonic escape sequenes (e.g. '\t' and '\n' and '\r')  Python accepts these and others like '\a' and '\b' and '\v' and '\f' in string literals.  anyone know of a function to convert to all of them?

anyone know of a function to convert FROM all escape sequences (like source literal compiling does)?
The codecs module with unicode_escape?