What is the use of '\b' (backspace)

前端 未结 4 1745
我寻月下人不归
我寻月下人不归 2021-01-13 16:30

I\'m taking a Python class right now, and I just learned about the backspace character. Like newline (\\n), backspace is a special character with ASCII code 8. My teacher c

4条回答
  •  滥情空心
    2021-01-13 17:03

    Backspace is a control character that moves the cursor one character back in the console but doesn't delete it.

    What's the reason for the backspace character, and how might it be used?

    It was used historically in the ASCII world to print accented characters.

    For example à could be produced using the three character sequence a Backspace ` (or, using the characters' hex values, 0x61 0x08 0x60).

    See more on backspace here

    Backspace key vs Backspace character

    A lot of people confuse the two. Backspace key on keyboard has almost the universal function to delete the previous character (= move cursor back and delete that character). The backspace character '\b' however only moves the cursor one position back in the console window and doesn't delete it.

提交回复
热议问题