Red Hat 7下python tab补全
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Red Hat 7下python tab补全相关的知识,希望对你有一定的参考价值。
最近学习python,总结一下如何添加shell脚本,达到(对象.)时,tab按2下调用所有方法的出现。
1、首先在目录:/usr/lib64/python2.7/site-packages下面建立vim tab.py文件。
2、tab.py文件下面的内容:
#!/usr/bin/python import os import readline import rlcompleter import atexit import os # tab completion readline.parse_and_bind(‘tab: complete‘) # history file histfile = os.path.join(os.environ[‘HOME‘],‘pythonhistory‘) try: readline.read_history_file(histfile) except IOError: pass atexit.register(readline.write_history_file,histfile) del os,histfile,readline,rlcompleter
然后:chmod 755 tab.py -----> ./tab.py(编译);
3、此时,在进入python的编译环境,在每次用到要补全函数前,必须事先导入这个包:import tab
示例:
以__开头的函数,是私有的,不能直接调用;就调用那些以字母开头的函数即可!!!
这样就达到了tab补全函数的功能了(前提:首先的导入tab模块,import tab);
本文出自 “11586096” 博客,请务必保留此出处http://11596096.blog.51cto.com/11586096/1857584
以上是关于Red Hat 7下python tab补全的主要内容,如果未能解决你的问题,请参考以下文章
Red Hat Enterprise Linux 7.5挂载NTFS移动硬盘