Python input function not work properly in linux

When I am writing a backup program for my minecraft server using python.

I find that when I want to use press backspace or arrow key, the input will not work properly.

Instead, it shows strange character like.

strange character

the solution is very simple

add import readline at the begining of the code will automatically fix the problem