Python DELETE character (Unicode 7F) does not seem to do anything. Shouldn't it delete the succeeding character, or am I doing it wrong?

StackOverflow https://stackoverflow.com/questions/13799637

Question

I went into my Python shell and tested this out, here are the results:

>>> print u"hi\u007F there"
hi there

According to my understanding of this character, it should have not shown the space in that string. What am I doing wrong?

Was it helpful?

Solution

The operation of the DELETE character (ASCII 7F) depends on the terminal; because it is being printed before the next character, it often does nothing at all. Historically, the meaning of the 7F unicode codepoint has been unclear.

The BACKSPACE code, 08, operates on the previous character. As the terminal has already printed that, works correctly:

>>> print u"hi \u0008there"
hithere

Perhaps you can use that instead?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top