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