Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
639 views
in Technique[技术] by (71.8m points)

ascii - What is the use of '' (backspace)

I'm taking a Python class right now, and I just learned about the backspace character. Like newline ( ), backspace is a special character with ASCII code 8. My teacher couldn't think of a reason to use that, but I'm curious as to how it's used. Maybe just historical reasons? When I tried print("Hellow World"), I got just got what I expected: Hello World.

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

Edit: I am aware that it isn't python specific, but when writing the original question I was thinking mainly about Python and forgot this fact. I've tried to edit to make this more clear.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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 '' however only moves the cursor one position back in the console window and doesn't delete it.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...