Python命令行自动补全和记录历史命令
2013-07-21 15:21
666 查看
[root@mm_local ~]# echo "export PYTHONSTARTUP='/root/.pythonstartup'" >> /root/.bashrc [root@mm_local ~]# source /root/.bashrc [root@mm_local ~]# cat /root/.pythonstartup import os import readline import rlcompleter import atexit #tab completion readline.parse_and_bind("tab: complete") #history file history_file = os.path.join(os.environ["HOME"],".pythonhistory") try: readline.read_history_file(history_file) except IOError: pass atexit.register(readline.write_history_file,history_file) del os,history_file,readline,rlcompleter [root@mm_local ~]# python Python 2.7.3 (default, Jun 5 2013, 22:40:26) [GCC 4.4.6 20110731 (Red Hat 4.4.6-3)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import sys >>> sys.path<tab> #按tab键就可以自动补全了 [root@mm_local ~]# python >>> >>> sys.path #按上下方向键即可找到历史命令
相关文章推荐
- 给python交互式命令行增加自动补全和命令历史
- 给python交互式命令行增加自动补全和命令历史
- 如何让python idle有命令自动补全和查看历史记录的方法
- PyCon 2011 - Hidden Treasures of the Python Standard Library - 为Python命令行添加了按键自动补全内容和命令历史功能
- python命令行添加自动补全和命令历史功能
- Python实现Tab自动补全和历史命令管理的方法
- uboot-2008-10之支持命令行历史记录、命令补全
- Python实现Tab自动补全和历史命令管理的方法
- 为Python添加交互模式下TAB自动补全以及命令历史功能
- Python添加tab自动补全及命令历史功能。
- Python实现Tab自动补全和历史命令管理的方法
- python在命令行和vim编辑器模式下自动补全
- shell脚本自动记录登录用户ip和历史命令
- 在python的交互式解释器中实现命令自动补全
- linux命令历史和 Tab 自动补全
- Python高级编程笔记(一)-- Linux下python命令行tab键自动补全功能设置
- linux “命令行自动补全”功能用命令
- 第二篇:自动补齐/命令行的历史记录/编辑命令行/可用的 Shell 快捷方式
- AIX 设置KSH的自动补全和历史命令功能
- python命令行自动补全