python中readline的用法

readline

问题:


(.env) [root@cd tmp]# python
Python 2.7.10 (default, Jul  4 2017, 17:45:34)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time^[[D^[[D^[[D
  File "", line 1
    import time
               ^
SyntaxError: invalid syntax
>>> ^[[A^[[A^[[A^[[B^[[B
  File "", line 1
    ^
SyntaxError: invalid syntax
>>>

无法回退,无法上翻,下翻....

安装 readline

(.env) [root@cd tmp]# pip install readline

安装 readline 之后:

(.env) [root@cd tmp]# python
Python 2.7.10 (default, Jul  4 2017, 17:45:34)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-17)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import time
>>> import time

你可能感兴趣的:(python中readline的用法)