Here's what to do about a problem you've encountered while trying out some code in the Python interactive console.
$ python
Python 3.5.6 (default, Sep 28 2019, 10:29:54)
[GCC 7.4.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
When I typed the arrow keys in the interactive console, I typed an unintended character. Specifically, if you enter the parentheses first like "method name ()" and then use the arrow keys to return to the parentheses and try to input, the following characters will appear.
>>> def index()^[[D
The above is the left key. --Right: ^ [[D --Top: ^ [[A --Bottom: ^ [[B
Unintended characters are entered, such as.
I solved it by putting the library in pip.
$ pip install gnureadline
On the other hand, according to pypi (gnu readline)
Please take note that IPython does not depend on gnureadline anymore since version 5.0 as it now uses prompt_toolkit instead.
(Note that since version 5.0, IPython uses prompt_toolkit instead, so it no longer depends on gnureadline.)
It is said that gnu readline is no longer dependent on the old version, but in the old version like the virtual environment (python 3.5) I set up, the interactive console worked safely by installing this library.
reference: pypi(gnureadline) stackoverflow
Recommended Posts