美文网首页
python中readline的用法

python中readline的用法

作者: jiaxiaolei | 来源:发表于2017-09-19 14:49 被阅读12次

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 "<stdin>", line 1
    import time
               ^
SyntaxError: invalid syntax
>>> ^[[A^[[A^[[A^[[B^[[B
  File "<stdin>", 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的用法

      本文链接:https://www.haomeiwen.com/subject/sdwwsxtx.html