I like the way Python interactive interpreter prints strings, and I want to repeat that specifically in scripts. However, I can't seem to do that.
Example. I can do this in interpreter:
>>> a="d\x04"
>>> a
'd\x04'
However, I cannot replicate this in the python itself
$ python -c 'a="d\x04";print a'
d
I want this because I want to debug a code with a lot of string with similar non-printable characters.
Is there an easy way to do this?