When I print the string value of 0x1b63
in bash, the screen clear (exactly like tput reset
result):
After pressing Enter
button we have:
What is going on?
It's ANSI escape sequences. There's a list of some on wikipedia
\x1b
means ESC
\x63
is a lower case c
On that page ESC
c
is shown as
RIS – Reset to Intitial State Resets the device to its original state. This may include (if applicable): reset graphic rendition, clear tabulation stops, reset to default font, and more.
so the terminal will clear. This isn't related to bash, or python, but the terminal that you're running in.